Multiple Naked LevelsPURPOSE OF THE INDICATOR
This indicator autogenerates and displays naked levels and gaps of multiple types collected into one simple and easy to use indicator.
VALUE PROPOSITION OF THE INDICATOR AND HOW IT IS ORIGINAL AND USEFUL
1) CONVENIENCE : The purpose of this indicator is to offer traders with one coherent and robust indicator providing useful, valuable, and often used levels - in one place.
2) CLUSTERS OF CONFLUENCES : With this indicator it is easy to identify levels and zones on the chart with multiple confluences increasing the likelihood of a potential reversal zone.
THE TYPES OF LEVELS AND GAPS INCLUDED IN THE INDICATOR
The types of levels include the following:
1) PIVOT levels (Daily/Weekly/Monthly) depicted in the chart as: dnPIV, wnPIV, mnPIV.
2) POC (Point of Control) levels (Daily/Weekly/Monthly) depicted in the chart as: dnPoC, wnPoC, mnPoC.
3) VAH/VAL STD 1 levels (Value Area High/Low with 1 std) (Daily/Weekly/Monthly) depicted in the chart as: dnVAH1/dnVAL1, wnVAH1/wnVAL1, mnVAH1/mnVAL1
4) VAH/VAL STD 2 levels (Value Area High/Low with 2 std) (Daily/Weekly/Monthly) depicted in the chart as: dnVAH2/dnVAL2, wnVAH2/wnVAL2, mnVAH1/mnVAL2
5) FAIR VALUE GAPS (Daily/Weekly/Monthly) depicted in the chart as: dnFVG, wnFVG, mnFVG.
6) CME GAPS (Daily) depicted in the chart as: dnCME.
7) EQUILIBRIUM levels (Daily/Weekly/Monthly) depicted in the chart as dnEQ, wnEQ, mnEQ.
HOW-TO ACTIVATE LEVEL TYPES AND TIMEFRAMES AND HOW-TO USE THE INDICATOR
You can simply choose which of the levels to be activated and displayed by clicking on the desired radio button in the settings menu.
You can locate the settings menu by clicking into the Object Tree window, left-click on the Multiple Naked Levels and select Settings.
You will then get a menu of different level types and timeframes. Click the checkboxes for the level types and timeframes that you want to display on the chart.
You can then go into the chart and check out which naked levels that have appeared. You can then use those levels as part of your technical analysis.
The levels displayed on the chart can serve as additional confluences or as part of your overall technical analysis and indicators.
In order to back-test the impact of the different naked levels you can also enable tapped levels to be depicted on the chart. Do this by toggling the 'Show tapped levels' checkbox.
Keep in mind however that Trading View can not shom more than 500 lines and text boxes so the indocator will not be able to give you the complete history back to the start for long duration assets.
In order to clean up the charts a little bit there are two additional settings that can be used in the Settings menu:
- Selecting the price range (%) from the current price to be included in the chart. The default is 25%. That means that all levels below or above 20% will not be displayed. You can set this level yourself from 0 up to 100%.
- Selecting the minimum gap size to include on the chart. The default is 1%. That means that all gaps/ranges below 1% in price difference will not be displayed on the chart. You can set the minimum gap size yourself.
BASIC DESCRIPTION OF THE INNER WORKINGS OF THE INDICTATOR
The way the indicator works is that it calculates and identifies all levels from the list of levels type and timeframes above. The indicator then adds this level to a list of untapped levels.
Then for each bar after, it checks if the level has been tapped. If the level has been tapped or a gap/range completely filled, this level is removed from the list so that the levels displayed in the end are only naked/untapped levels.
Below is a descrition of each of the level types and how it is caluclated (algorithm):
PIVOT
Daily, Weekly and Monthly levels in trading refer to significant price points that traders monitor within the context of a single trading day. These levels can provide insights into market behavior and help traders make informed decisions regarding entry and exit points.
Traders often use D/W/M levels to set entry and exit points for trades. For example, entering long positions near support (daily close) or selling near resistance (daily close).
Daily levels are used to set stop-loss orders. Placing stops just below the daily close for long positions or above the daily close for short positions can help manage risk.
The relationship between price movement and daily levels provides insights into market sentiment. For instance, if the price fails to break above the daily high, it may signify bearish sentiment, while a strong breakout can indicate bullish sentiment.
The way these levels are calculated in this indicator is based on finding pivots in the chart on D/W/M timeframe. The level is then set to previous D/W/M close = current D/W/M open.
In addition, when price is going up previous D/W/M open must be smaller than previous D/W/M close and current D/W/M close must be smaller than the current D/W/M open. When price is going down the opposite.
POINT OF CONTROL
The Point of Control (POC) is a key concept in volume profile analysis, which is commonly used in trading.
It represents the price level at which the highest volume of trading occurred during a specific period.
The POC is derived from the volume traded at various price levels over a defined time frame. In this indicator the timeframes are Daily, Weekly, and Montly.
It identifies the price level where the most trades took place, indicating strong interest and activity from traders at that price.
The POC often acts as a significant support or resistance level. If the price approaches the POC from above, it may act as a support level, while if approached from below, it can serve as a resistance level. Traders monitor the POC to gauge potential reversals or breakouts.
The way the POC is calculated in this indicator is by an approximation by analysing intrabars for the respective timeperiod (D/W/M), assigning the volume for each intrabar into the price-bins that the intrabar covers and finally identifying the bin with the highest aggregated volume.
The POC is the price in the middle of this bin.
The indicator uses a sample space for intrabars on the Daily timeframe of 15 minutes, 35 minutes for the Weekly timeframe, and 140 minutes for the Monthly timeframe.
The indicator has predefined the size of the bins to 0.2% of the price at the range low. That implies that the precision of the calulated POC og VAH/VAL is within 0.2%.
This reduction of precision is a tradeoff for performance and speed of the indicator.
This also implies that the bigger the difference from range high prices to range low prices the more bins the algorithm will iterate over. This is typically the case when calculating the monthly volume profile levels and especially high volatility assets such as alt coins.
Sometimes the number of iterations becomes too big for Trading View to handle. In these cases the bin size will be increased even more to reduce the number of iterations.
In such cases the bin size might increase by a factor of 2-3 decreasing the accuracy of the Volume Profile levels.
Anyway, since these Volume Profile levels are approximations and since precision is traded for performance the user should consider the Volume profile levels(POC, VAH, VAL) as zones rather than pin point accurate levels.
VALUE AREA HIGH/LOW STD1/STD2
The Value Area High (VAH) and Value Area Low (VAL) are important concepts in volume profile analysis, helping traders understand price levels where the majority of trading activity occurs for a given period.
The Value Area High/Low is the upper/lower boundary of the value area, representing the highest price level at which a certain percentage of the total trading volume occurred within a specified period.
The VAH/VAL indicates the price point above/below which the majority of trading activity is considered less valuable. It can serve as a potential resistance/support level, as prices above/below this level may experience selling/buying pressure from traders who view the price as overvalued/undervalued
In this indicator the timeframes are Daily, Weekly, and Monthly. This indicator provides two boundaries that can be selected in the menu.
The first boundary is 70% of the total volume (=1 standard deviation from mean). The second boundary is 95% of the total volume (=2 standard deviation from mean).
The way VAH/VAL is calculated is based on the same algorithm as for the POC.
However instead of identifying the bin with the highest volume, we start from range low and sum up the volume for each bin until the aggregated volume = 30%/70% for VAL1/VAH1 and aggregated volume = 5%/95% for VAL2/VAH2.
Then we simply set the VAL/VAH equal to the low of the respective bin.
FAIR VALUE GAPS
Fair Value Gaps (FVG) is a concept primarily used in technical analysis and price action trading, particularly within the context of futures and forex markets. They refer to areas on a price chart where there is a noticeable lack of trading activity, often highlighted by a significant price movement away from a previous level without trading occurring in between.
FVGs represent price levels where the market has moved significantly without any meaningful trading occurring. This can be seen as a "gap" on the price chart, where the price jumps from one level to another, often due to a rapid market reaction to news, events, or other factors.
These gaps typically appear when prices rise or fall quickly, creating a space on the chart where no transactions have taken place. For example, if a stock opens sharply higher and there are no trades at the prices in between the two levels, it creates a gap. The areas within these gaps can be areas of liquidity that the market may return to βfillβ later on.
FVGs highlight inefficiencies in pricing and can indicate areas where the market may correct itself. When the market moves rapidly, it may leave behind price levels that traders eventually revisit to establish fair value.
Traders often watch for these gaps as potential reversal or continuation points. Many traders believe that price will eventually βfillβ the gap, meaning it will return to those price levels, providing potential entry or exit points.
This indicator calculate FVGs on three different timeframes, Daily, Weekly and Montly.
In this indicator the FVGs are identified by looking for a three-candle pattern on a chart, signalling a discrete imbalance in order volume that prompts a quick price adjustment. These gaps reflect moments where the market sentiment strongly leans towards buying or selling yet lacks the opposite orders to maintain price stability.
The indicator sets the gap to the difference from the high of the first bar to the low of the third bar when price is moving up or from the low of the first bar to the high of the third bar when price is moving down.
CME GAPS (BTC only)
CME gaps refer to price discrepancies that can occur in charts for futures contracts traded on the Chicago Mercantile Exchange (CME). These gaps typically arise from the fact that many futures markets, including those on the CME, operate nearly 24 hours a day but may have significant price movements during periods when the market is closed.
CME gaps occur when there is a difference between the closing price of a futures contract on one trading day and the opening price on the following trading day. This difference can create a "gap" on the price chart.
Opening Gaps: These usually happen when the market opens significantly higher or lower than the previous day's close, often influenced by news, economic data releases, or other market events occurring during non-trading hours.
Gaps can result from reactions to major announcements or developments, such as earnings reports, geopolitical events, or changes in economic indicators, leading to rapid price movements.
The importance of CME Gaps in Trading is the potential for Filling Gaps: Many traders believe that prices often "fill" gaps, meaning that prices may return to the gap area to establish fair value.
This can create potential trading opportunities based on the expectation of gap filling. Gaps can act as significant support or resistance levels. Traders monitor these levels to identify potential reversal points in price action.
The way the gap is identified in this indicator is by checking if current open is higher than previous bar close when price is moving up or if current open is lower than previous day close when price is moving down.
EQUILIBRIUM
Equilibrium in finance and trading refers to a state where supply and demand in a market balance each other, resulting in stable prices. It is a key concept in various economic and trading contexts. Hereβs a concise description:
Market Equilibrium occurs when the quantity of a good or service supplied equals the quantity demanded at a specific price level. At this point, there is no inherent pressure for the price to change, as buyers and sellers are in agreement.
Equilibrium Price is the price at which the market is in equilibrium. It reflects the point where the supply curve intersects the demand curve on a graph. At the equilibrium price, the market clears, meaning there are no surplus goods or shortages.
In this indicator the equilibrium level is calculated simply by finding the midpoint of the Daily, Weekly, and Montly candles respectively.
NOTES
1) Performance. The algorithms are quite resource intensive and the time it takes the indicator to calculate all the levels could be 5 seconds or more, depending on the number of bars in the chart and especially if Montly Volume Profile levels are selected (POC, VAH or VAL).
2) Levels displayed vs the selected chart timeframe. On a timeframe smaller than the daily TF - both Daily, Weekly, and Monthly levels will be displayed. On a timeframe bigger than the daily TF but smaller than the weekly TF - the Weekly and Monthly levels will be display but not the Daily levels. On a timeframe bigger than the weekly TF but smaller than the monthly TF - only the Monthly levels will be displayed. Not Daily and Weekly.
CREDITS
The core algorithm for calculating the POC levels is based on the indicator "Naked Intrabar POC" developed by rumpypumpydumpy (https:www.tradingview.com/u/rumpypumpydumpy/).
The "Naked intrabar POC" indicator calculates the POC on the current chart timeframe.
This indicator (Multiple Naked Levels) adds two new features:
1) It calculates the POC on three specific timeframes, the Daily, Weekly, and Monthly timeframes - not only the current chart timeframe.
2) It adds functionaly by calculating the VAL and VAH of the volume profile on the Daily, Weekly, Monthly timeframes .
Cari dalam skrip untuk "volume profile"
Ruckard TradingLatinoThis strategy tries to mimic TradingLatino strategy.
The current implementation is beta.
Si hablas castellano o espanyol por favor consulta MENSAJE EN CASTELLANO mΓ‘s abajo.
It's aimed at BTCUSDT pair and 4h timeframe.
STRATEGY DEFAULT SETTINGS EXPLANATION
max_bars_back=5000 : This is a random number of bars so that the strategy test lasts for one or two years
calc_on_order_fills=false : To wait for the 4h closing is too much. Try to check if it's worth entering a position after closing one. I finally decided not to recheck if it's worth entering after an order is closed. So it is false.
calc_on_every_tick=false
pyramiding=0 : We only want one entry allowed in the same direction. And we don't want the order to scale by error.
initial_capital=1000 : These are 1000 USDT. By using 1% maximum loss per trade and 7% as a default stop loss by using 1000 USDT at 12000 USDT per BTC price you would entry with around 142 USDT which are converted into: 0.010 BTC . The maximum number of decimal for contracts on this BTCUSDT market is 3 decimals. E.g. the minimum might be: 0.001 BTC . So, this minimal 1000 amount ensures us not to entry with less than 0.001 entries which might have happened when using 100 USDT as an initial capital.
slippage=1 : Binance BTCUSDT mintick is: 0.01. Binance slippage: 0.1 % (Let's assume). TV has an integer slippage. It does not have a percentage based slippage. If we assume a 1000 initial capital, the recommended equity is 142 which at 11996 USDT per BTC price means: 0.011 BTC. The 0.1% slippage of: 0.011 BTC would be: 0.000011 . This is way smaller than the mintick. So our slippage is going to be 1. E.g. 1 (slippage) * 0.01 (mintick)
commission_type=strategy.commission.percent and commission_value=0.1 : According to: binance . com / en / fee / schedule in VIP 0 level both maker and taker fees are: 0.1 %.
BACKGROUND
Jaime Merino is a well known Youtuber focused on crypto trading
His channel TradingLatino
features monday to friday videos where he explains his strategy.
JAIME MERINO STANCE ON BOTS
Jaime Merino stance on bots (taken from memory out of a 2020 June video from him):
'~
You know. They can program you a bot and it might work.
But, there are some special situations that the bot would not be able to handle.
And, I, as a human, I would handle it. And the bot wouldn't do it.
~'
My long term target with this strategy script is add as many
special situations as I can to the script
so that it can match Jaime Merino behaviour even in non normal circumstances.
My alternate target is learn Pine script
and enjoy programming with it.
WARNING
This script might be bigger than other TradingView scripts.
However, please, do not be confused because the current status is beta.
This script has not been tested with real money.
This is NOT an official strategy from Jaime Merino.
This is NOT an official strategy from TradingLatino . net .
HOW IT WORKS
It basically uses ADX slope and LazyBear's Squeeze Momentum Indicator
to make its buy and sell decisions.
Fast paced EMA being bigger than slow paced EMA
(on higher timeframe) advices going long.
Fast paced EMA being smaller than slow paced EMA
(on higher timeframe) advices going short.
It finally add many substrats that TradingLatino uses.
SETTINGS
__ SETTINGS - Basics
____ SETTINGS - Basics - ADX
(ADX) Smoothing {14}
(ADX) DI Length {14}
(ADX) key level {23}
____ SETTINGS - Basics - LazyBear Squeeze Momentum
(SQZMOM) BB Length {20}
(SQZMOM) BB MultFactor {2.0}
(SQZMOM) KC Length {20}
(SQZMOM) KC MultFactor {1.5}
(SQZMOM) Use TrueRange (KC) {True}
____ SETTINGS - Basics - EMAs
(EMAS) EMA10 - Length {10}
(EMAS) EMA10 - Source {close}
(EMAS) EMA55 - Length {55}
(EMAS) EMA55 - Source {close}
____ SETTINGS - Volume Profile
Lowest and highest VPoC from last three days
is used to know if an entry has a support
VPVR of last 100 4h bars
is also taken into account
(VP) Use number of bars (not VP timeframe): Uses 'Number of bars {100}' setting instead of 'Volume Profile timeframe' setting for calculating session VPoC
(VP) Show tick difference from current price {False}: BETA . Might be useful for actions some day.
(VP) Number of bars {100}: If 'Use number of bars (not VP timeframe)' is turned on this setting is used to calculate session VPoC.
(VP) Volume Profile timeframe {1 day}: If 'Use number of bars (not VP timeframe)' is turned off this setting is used to calculate session VPoC.
(VP) Row width multiplier {0.6}: Adjust how the extra Volume Profile bars are shown in the chart.
(VP) Resistances prices number of decimal digits : Round Volume Profile bars label numbers so that they don't have so many decimals.
(VP) Number of bars for bottom VPOC {18}: 18 bars equals 3 days in suggested timeframe of 4 hours. It's used to calculate lowest session VPoC from previous three days. It's also used as a top VPOC for sells.
(VP) Ignore VPOC bottom advice on long {False}: If turned on it ignores bottom VPOC (or top VPOC on sells) when evaluating if a buy entry is worth it.
(VP) Number of bars for VPVR VPOC {100}: Number of bars to calculate the VPVR VPoC. We use 100 as Jaime once used. When the price bounces back to the EMA55 it might just bounce to this VPVR VPoC if its price it's lower than the EMA55 (Sells have inverse algorithm).
____ SETTINGS - ADX Slope
ADX Slope
help us to understand if ADX
has a positive slope, negative slope
or it is rather still.
(ADXSLOPE) ADX cut {23}: If ADX value is greater than this cut (23) then ADX has strength
(ADXSLOPE) ADX minimum steepness entry {45}: ADX slope needs to be 45 degrees to be considered as a positive one.
(ADXSLOPE) ADX minimum steepness exit {45}: ADX slope needs to be -45 degrees to be considered as a negative one.
(ADXSLOPE) ADX steepness periods {3}: In order to avoid false detection the slope is calculated along 3 periods.
____ SETTINGS - Next to EMA55
(NEXTEMA55) EMA10 to EMA55 bounce back percentage {80}: EMA10 might bounce back to EMA55 or maybe to 80% of its complete way to EMA55
(NEXTEMA55) Next to EMA55 percentage {15}: How much next to the EMA55 you need to be to consider it's going to bounce back upwards again.
____ SETTINGS - Stop Loss and Take Profit
You can set a default stop loss or a default take profit.
(STOPTAKE) Stop Loss % {7.0}
(STOPTAKE) Take Profit % {2.0}
____ SETTINGS - Trailing Take Profit
You can customize the default trailing take profit values
(TRAILING) Trailing Take Profit (%) {1.0}: Trailing take profit offset in percentage
(TRAILING) Trailing Take Profit Trigger (%) {2.0}: When 2.0% of benefit is reached then activate the trailing take profit.
____ SETTINGS - MAIN TURN ON/OFF OPTIONS
(EMAS) Ignore advice based on emas {false}.
(EMAS) Ignore advice based on emas (On closing long signal) {False}: Ignore advice based on emas but only when deciding to close a buy entry.
(SQZMOM) Ignore advice based on SQZMOM {false}: Ignores advice based on SQZMOM indicator.
(ADXSLOPE) Ignore advice based on ADX positive slope {false}
(ADXSLOPE) Ignore advice based on ADX cut (23) {true}
(STOPTAKE) Take Profit? {false}: Enables simple Take Profit.
(STOPTAKE) Stop Loss? {True}: Enables simple Stop Loss.
(TRAILING) Enable Trailing Take Profit (%) {True}: Enables Trailing Take Profit.
____ SETTINGS - Strategy mode
(STRAT) Type Strategy: 'Long and Short', 'Long Only' or 'Short Only'. Default: 'Long and Short'.
____ SETTINGS - Risk Management
(RISKM) Risk Management Type: 'Safe', 'Somewhat safe compound' or 'Unsafe compound'. ' Safe ': Calculations are always done with the initial capital (1000) in mind. The maximum losses per trade/day/week/month are taken into account. ' Somewhat safe compound ': Calculations are done with initial capital (1000) or a higher capital if it increases. The maximum losses per trade/day/week/month are taken into account. ' Unsafe compound ': In each order all the current capital is gambled and only the default stop loss per order is taken into account. That means that the maximum losses per trade/day/week/month are not taken into account. Default : 'Somewhat safe compound'.
(RISKM) Maximum loss per trade % {1.0}.
(RISKM) Maximum loss per day % {6.0}.
(RISKM) Maximum loss per week % {8.0}.
(RISKM) Maximum loss per month % {10.0}.
____ SETTINGS - Decimals
(DECIMAL) Maximum number of decimal for contracts {3}: How small (3 decimals means 0.001) an entry position might be in your exchange.
EXTRA 1 - PRICE IS IN RANGE indicator
(PRANGE) Print price is in range {False}: Enable a bottom label that indicates if the price is in range or not.
(PRANGE) Price range periods {5}: How many previous periods are used to calculate the medians
(PRANGE) Price range maximum desviation (%) {0.6} ( > 0 ): Maximum positive desviation for range detection
(PRANGE) Price range minimum desviation (%) {0.6} ( > 0 ): Mininum negative desviation for range detection
EXTRA 2 - SQUEEZE MOMENTUM Desviation indicator
(SQZDIVER) Show degrees {False}: Show degrees of each Squeeze Momentum Divergence lines to the x-axis.
(SQZDIVER) Show desviation labels {False}: Whether to show or not desviation labels for the Squeeze Momentum Divergences.
(SQZDIVER) Show desviation lines {False}: Whether to show or not desviation lines for the Squeeze Momentum Divergences.
EXTRA 3 - VOLUME PROFILE indicator
WARNING: This indicator works not on current bar but on previous bar. So in the worst case it might be VP from 4 hours ago. Don't worry, inside the strategy calculus the correct values are used. It's just that I cannot show the most recent one in the chart.
(VP) Print recent profile {False}: Show Volume Profile indicator
(VP) Avoid label price overlaps {False}: Avoid label prices to overlap on the chart.
EXTRA 4 - ZIGNALY SUPPORT
(ZIG) Zignaly Alert Type {Email}: 'Email', 'Webhook'. ' Email ': Prepare alert_message variable content to be compatible with zignaly expected email content format. ' Webhook ': Prepare alert_message variable content to be compatible with zignaly expected json content format.
EXTRA 5 - DEBUG
(DEBUG) Enable debug on order comments {False}: If set to true it prepares the order message to match the alert_message variable. It makes easier to debug what would have been sent by email or webhook on each of the times an order is triggered.
HOW TO USE THIS STRATEGY
BOT MODE: This is the default setting.
PROPER VOLUME PROFILE VIEWING: Click on this strategy settings. Properties tab. Make sure Recalculate 'each time the order was run' is turned off.
NEWBIE USER: (Check PROPER VOLUME PROFILE VIEWING above!) You might want to turn on the 'Print recent profile {False}' setting. Alternatively you can use my alternate realtime study: 'Resistances and supports based on simplified Volume Profile' but, be aware, it might consume one indicator.
ADVANCED USER 1: Turn on the 'Print price is in range {False}' setting and help us to debug this subindicator. Also help us to figure out how to include this value in the strategy.
ADVANCED USER 2: Turn on the all the (SQZDIVER) settings and help us to figure out how to include this value in the strategy.
ADVANCED USER 3: (Check PROPER VOLUME PROFILE VIEWING above!) Turn on the 'Print recent profile {False}' setting and report any problem with it.
JAIME MERINO: Just use the indicator as it comes by default. It should only show BUY signals, SELL signals and their associated closing signals. From time to time you might want to check 'ADVANCED USER 2' instructions to check that there's actually a divergence. Check also 'ADVANCED USER 1' instructions for your amusement.
EXTRA ADVICE
It's advised that you use this strategy in addition to these two other indicators:
* Squeeze Momentum Indicator
* ADX
so that your chart matches as close as possible to TradingLatino chart.
ZIGNALY INTEGRATION
This strategy supports Zignaly email integration by default. It also supports Zignaly Webhook integration.
ZIGNALY INTEGRATION - Email integration example
What you would write in your alert message:
||{{strategy.order.alert_message}}||key=MYSECRETKEY||
ZIGNALY INTEGRATION - Webhook integration example
What you would write in your alert message:
{ {{strategy.order.alert_message}} , "key" : "MYSECRETKEY" }
CREDITS
I have reused and adapted some code from
'Directional Movement Index + ADX & Keylevel Support' study
which it's from TradingView console user.
I have reused and adapted some code from
'3ema' study
which it's from TradingView hunganhnguyen1193 user.
I have reused and adapted some code from
'Squeeze Momentum Indicator ' study
which it's from TradingView LazyBear user.
I have reused and adapted some code from
'Strategy Tester EMA-SMA-RSI-MACD' study
which it's from TradingView fikira user.
I have reused and adapted some code from
'Support Resistance MTF' study
which it's from TradingView LonesomeTheBlue user.
I have reused and adapted some code from
'TF Segmented Linear Regression' study
which it's from TradingView alexgrover user.
I have reused and adapted some code from
"Poor man's volume profile" study
which it's from TradingView IldarAkhmetgaleev user.
FEEDBACK
Please check the strategy source code for more detailed information
where, among others, I explain all of the substrats
and if they are implemented or not.
Q1. Did I understand wrong any of the Jaime substrats (which I have implemented)?
Q2. The strategy yields quite profit when we should long (EMA10 from 1d timeframe is higher than EMA55 from 1d timeframe.
Why the strategy yields much less profit when we should short (EMA10 from 1d timeframe is lower than EMA55 from 1d timeframe)?
Any idea if you need to do something else rather than just reverse what Jaime does when longing?
FREQUENTLY ASKED QUESTIONS
FAQ1. Why are you giving this strategy for free?
TradingLatino and his fellow enthusiasts taught me this strategy. Now I'm giving back to them.
FAQ2. Seriously! Why are you giving this strategy for free?
I'm confident his strategy might be improved a lot. By keeping it to myself I would avoid other people contributions to improve it.
Now that everyone can contribute this is a win-win.
FAQ3. How can I connect this strategy to my Exchange account?
It seems that you can attach alerts to strategies.
You might want to combine it with a paying account which enable Webhook URLs to work.
I don't know how all of this works right now so I cannot give you advice on it.
You will have to do your own research on this subject. But, be careful. Automating trades, if not done properly,
might end on you automating losses.
FAQ4. I have just found that this strategy by default gives more than 3.97% of 'maximum series of losses'. That's unacceptable according to my risk management policy.
You might want to reduce default stop loss setting from 7% to something like 5% till you are ok with the 'maximum series of losses'.
FAQ5. Where can I learn more about your work on this strategy?
Check the source code. You might find unused strategies. Either because there's not a substantial increases on earnings. Or maybe because they have not been implemented yet.
FAQ6. How much leverage is applied in this strategy?
No leverage.
FAQ7. Any difference with original Jaime Merino strategy?
Most of the times Jaime defines an stop loss at the price entry. That's not the case here. The default stop loss is 7% (but, don't be confused it only means losing 1% of your investment thanks to risk management). There's also a trailing take profit that triggers at 2% profit with a 1% trailing.
FAQ8. Why this strategy return is so small?
The strategy should be improved a lot. And, well, backtesting in this platform is not guaranteed to return theoric results comparable to real-life returns. That's why I'm personally forward testing this strategy to verify it.
MENSAJE EN CASTELLANO
En primer lugar se agradece feedback para mejorar la estrategia.
Si eres un usuario avanzado y quieres colaborar en mejorar el script no dudes en comentar abajo.
Ten en cuenta que aunque toda esta descripciΓ³n tenga que estar en inglΓ©s no es obligatorio que el comentario estΓ© en inglΓ©s.
CHISTE - CASTELLANO
Β‘Pero Jaime!
Β‘400.000!
Β‘Tu da mun!
Historic VPoCs and pseudo VPVRThis study tries to recreate session based historic VPoCs
and VPVR Volume Profile
as they are used by
TradingLatino TradingView user.
It's aimed at BTCUSDT pair and 4h timeframe.
HOW IT WORKS
HOW IT WORKS - VPVR Profile Block
It gathers volume from the last chosen Bars
in order to draw the vpvr profile block
Volume that intersects with current level range
being studied is added to its value.
Additionally the current level price is modified
so that it matches the level price where most
of the volume has concentrated
So you get a pretty accurate price for drawn volume
while at the same time the levels are not stuck
to arbitrary level prices.
HOW IT WORKS - VPoC
It calculates a Volume Profile for the
given historic session but then
it only outputs that Volume Profile VPoC.
SETTINGS
Show VPVR Volume Profile {True}.
Show Historic VPoC lines {True}.
Show Historic VPoC labels {True}.
Extend Historic VPoC lines {True}: If this option is turned off the VPoC lines are only shown during the session duration.
Show tick difference from current price {False}: BETA. Feedback is needed because I'm not sure how it should work this setting.
VPVR Number of bars {100}: Define the Visible Range in number of bars so that its Volume Profile can be shown.
VPVR Profile width (in bars) {15}: VPVR Profile can be make larger or smaller in width thanks to this option.
VPVR Profile offset (in bars) {15}: VPVR Profile can be shown more to the left or to the right if the defaults do not suit you.
Historic Session Volume Profile timeframe {1D}: Historic VPoC use 1 day as their timeframe reference by default.
Number of decimal digits {2}: How many decimal digits are shown in label prices.
Number of previous sessions to print VPoC {5}: How many previous sessions VPoCs are to be printed. The maximum for this setting is 20.
Historic VPoC lines width (in pixels) {2}.
Historic VPoC labels size {small}.
History VPoC line offset (in bars) {5}: How far to the right VPoCs lines are to be extended. Note: This setting does not apply when 'Extend Historic VPoC lines' is set to 'False'.
WARNING
Please be aware that VPoC from the first previous session might not be accurate due to Pine Script limitations.
VPVR USAGE
This is not a VPVR like the official TradingView indicator.
This is a pseudo VPVR and that means it needs some manual input from you.
But, don't worry it's quite easy to do and if you always use the same number
of bars to calculate your VPVR then you might even just set it up once.
In order to show the VPVR (or Volume Profile on the Visible Range):
Rescale your chart so that you see all the bars for your Visible Range.
Click on the ruler tool.
Click on the last bar (far to the right) shown on the screen
Drag the ruler to first bar (far to the left) shown on the screen
Check what the ruler says
E.g. it says: 101 bars
Open this study settings
Modify: 'VPVR Number of bars ' setting
So that its value matches your measured number of bars (101)
Press OK to confirm and wait for the indicator to refresh.
STRATEGY USAGE
If your strategy uses VPoC
to define your resistances
or supports
you can check the VPoCs shown here.
FEEDBACK
I have only used this identifier in BTCUSDT 4h timeframe.
I'm interested to know what needs to be tweaked
in other securities and timeframes.
PINE STUDY TRICK
This study let's you choose the number of decimals the label will use.
CREDITS
I have reused and adapted some code from
'Poor man's volume profile' study
which it's from TradingView IldarAkhmetgaleev user.
I also wanted to thank him for helping me understanding his study.
I have reused some code from
'MTF Selection Framework - PineCoders FAQ' study
which it's from TradingView PineCoders user.
Delta Volume Candles [LucF]ββ OVERVIEW
This indicator plots on-chart volume delta information using candles that can replace your normal candles, tops and bottoms appended to normal candles, optional MAs of those tops and bottoms levels, a divergence channel and a chart background. The indicator calculates volume delta using intrabar analysis, meaning that it uses the lower timeframe bars constituting each chart bar.
ββ CONCEPTS
Volume Delta
βThe βvolume delta concept divides a bar's βvolume in "up" and "down" βvolumes. The delta is calculated by subtracting down βvolume from up βvolume. Many calculation techniques exist to isolate up and down βvolume within a bar. The simplest use the polarity of interbar price changes to assign their βvolume to up or down slots, e.g., On Balance Volume or the Klinger Oscillator . Others such as Chaikin Money Flow use assumptions based on a bar's OHLC values. The most precise calculation method uses tick data and assigns the βvolume of each tick to the up or down slot depending on whether the transaction occurs at the bid or ask price. While this technique is ideal, it requires huge amounts of data on historical bars, which considerably limits the historical depth of charts and the number of symbols for which tick data is available. Furthermore, historical tick data is not yet available on TradingView.
This indicator uses intrabar analysis to achieve a compromise between the simplest and most precise methods of calculating βvolume delta. It is currently the most precise method usable on TradingView charts. TradingView's Volume Profile built-in indicators use it, as do the CVD - Cumulative βVolume Delta Candles and CVD - Cumulative Volume Delta (Chart) indicators published from the TradingView account . My Delta Volume Channels and Volume Delta Columns Pro indicators also use intrabar analysis. Other βvolume delta indicators such as my Realtime 5D Profile use realtime chart updates to calculate volume delta without intrabar analysis, but that type of indicator only works in real time; they cannot calculate on historical bars.
This is the logic I use to determine the polarity of intrabars, which determines the up or down slot where its βvolume is added:
ββ’ If the intrabar's open and close values are different, their relative position is used.
ββ’ If the intrabar's open and close values are the same, the difference between the intrabar's close and the previous intrabar's close is used.
ββ’ As a last resort, when there is no movement during an intrabar, and it closes at the same price as the previous intrabar, the last known polarity is used.
Once all intrabars making up a chart bar have been analyzed and the up or down property of each intrabar's βvolume determined, the up volumes are added, and the down volumes subtracted. The resulting value is βvolume delta for that chart bar, which can be used as an estimate of the buying/selling pressure on an instrument. Not all markets have volume information. Without it, this indicator is useless.
Intrabar analysis
Intrabars are chart bars at a lower timeframe than the chart's. The timeframe used to access intrabars determines the number of intrabars accessible for each chart bar. On a 1H chart, each chart bar of an active market will, for example, usually contain 60 bars at the lower timeframe of 1min, provided there was market activity during each minute of the hour.
This indicator automatically calculates an appropriate lower timeframe using the chart's timeframe and the settings you use in the script's "Intrabars" section of the inputs. As it can access lower timeframes as small as seconds when available, the indicator can be used on charts at relatively small timeframes such as 1min, provided the market is active enough to produce bars at second timeframes.
The quantity of intrabars analyzed in each chart bar determines:
ββ’ The precision of calculations (more intrabars yield more precise results).
ββ’ The chart coverage of calculations (there is a 100K limit to the quantity of intrabars that can be analyzed on any chart,
ββso the more intrabars you analyze per chart bar, the less chart bars can be calculated by the indicator).
The information box displayed at the bottom right of the chart shows the lower timeframe used for intrabars, as well as the average number of intrabars detected for chart bars and statistics on chart coverage.
Balances
This indicator calculates five balances from volume delta values. The balances are oscillators with a zero centerline; positive values are bullish, and negative values are bearish. It is important to understand the balances as they can be used to:
ββ’ Color candle bodies.
ββ’ Calculate body and top and bottom divergences.
ββ’ Color an EMA channel.
ββ’ Color the chart's background.
ββ’ Configure markers and alerts.
The five balances are:
1 β Bar Balance : This is the only balance using instant values; it is simply the subtraction of the down volumeβ from the up volumeβ on the bar, so the instant volume delta for that bar.
2 β Average Balance : Calculates a distinct EMA for both the up and down volumes, and subtracts the down EMA from the up EMA.
ββThe result is akin to MACD's histogram because it is the subtraction of two moving averages.
3 β Momentum Balance : Starts by calculating, separately for both up and down volumes, the difference between the same EMAs used in "Average Balance" and
ββan SMA of twice the period used for the "Average Balance" EMAs. The difference for the up side is subtracted from the difference for the down side,
ββand an RSI of that value is calculated and brought over the β50/+50 scale.
4 β Relative Balance : The reference values used in the calculation are the up and down EMAs used in the "Average Balance".
ββFrom those, we calculate two intermediate values using how much the instant up and down volumes on the bar exceed their respective EMAβββbut with a twist.
ββIf the bar's up volumeβ does not exceed the EMA of up volumeβ, a zero value is used. The same goes for the down volumeβ with the EMA of down volumeβ.
ββOnce we have our two intermediate values for the up and down volumes exceeding their respective MA, we subtract them. The final value is an ALMA of that subtraction.
ββThe rationale behind using zero values when the bar's up/down volumeβ does not exceed its EMA is to only take into account the more significant volumeβ.
ββIf both instant volumeβ values exceed their MA, then the difference between the two is the signal's value.
ββThe signal is called "relative" because the intermediate values are the difference between the instant up/down volumes and their respective MA.
ββThis balance flatlines when the bar's up/down volumes do not exceed their EMAs, which makes it useful to spot areas where trader interest dwindles, such as consolidations.
ββThe smaller the period of the final value's ALMA, the more easily it will flatline. These flat zones should be considered no-trade zones.
5 β Percent Balance : This balance is the ALMA of the ratio of the "Bar Balance" over the total volume for that bar.
From the balances and marker conditions, two more values are calculated:
1 β Marker Bias : This sums the up/down (+1/β1) occurrences of the markers 1 to 4 over a period you define, so it ranges from β4 to +4, times the period.
ββIts calculation will depend on the modes used to calculate markers 3 and 4.
2 β Combined Balances : This is the sum of the bull/bear (+1/β1) states of each of the five balances, so it ranges from β5 to +5.
The periods for all of these balances can be configured in the "Periods" section at the bottom of the script's inputs. As you cannot see the balances on the chart, you can use my Volume Delta Columns Pro indicator in a pane; it can plot the same balances, so you will be able to analyze them.
Divergences
In the context of this indicator, a divergence is any bar where the bear/bull state of a balance (above/below its zero centerline) diverges from the polarity of a chart bar. No directional bias is assigned to divergences when they occur. Candle bodies and tops/bottoms can each be colored differently on divergences detected from distinct balances.
Divergence Channel
The divergence channel is the space between two levels (by default, the bar's open and close ) saved when divergences occur. When price (by default the close ) has breached a channel and a new divergence occurs, a new channel is created. Until that new channel is breached, bars where additional divergences occur will expand the channel's levels if the bar's price points are outside the channel.
Prices breaches of the divergence channel will change its state. Divergence channels can be in one of three different states:
ββ’ Bull (green): Price has breached the channel to the upside.
ββ’ Bear (red): Price has breached the channel to the downside.
ββ’ Neutral (gray): The channel has not yet been breached.
ββ HOW TO USE THE INDICATOR
I do not make videos to explain how to use my indicators. I do, however, try hard to include in their description everything one needs to understand what they do. From there, it's up to you to explore and figure out if they can be useful in your trading practice. Communicating in videos what this description and the script's tooltips contain would make for very long videos that would likely exceed the attention span of most people who find this description too long. There is no quick way to understand an indicator such as this one because it uses many different concepts and has quite a bit of settings one can use to modify its visuals and behavior β thus how one uses it. I will happily answer questions on the inner workings of the indicator, but I do not answer questions like "How do I trade using this indicator?" A useful answer to that question would require an in-depth analysis of who you are, your trading methodology and objectives, which I do not have time for. I do not teach trading.
Start by loading the indicator on an active chart containing volume information. See here if you need help.
The default configuration displays:
ββ’ Normal candles where the bodies are only colored if the bar's volume has increased since the last bar.
ββIf you want to use this indicator's candles, you may want to disable your chart's candles by clicking the eye icon to the right of the symbol's name in the top left of the chart.
ββ’ A top or bottom appended to the normal candles. It represents the difference between up and down volume for that bar
ββand is positioned at the top or bottom, depending on its polarity. If up volume is greater than down volume, a top is displayed. If down volume is greater, a bottom is plotted.
ββThe size of tops and bottoms is determined by calculating a factor which is the proportion of volume delta over the bar's total volume.
ββThat factor is then used to calculate the top or bottom size relative to a baseline of the average candle body size of the last 100 bars.
ββ’ An information box in the bottom right displaying intrabar and chart coverage information.
ββ’ A light red background when the intrabar volume differs from the chart's volume by more than 1%.
The script's inputs contain tooltips explaining most of the fields. I will not repeat them here. Following is a brief description of each section of the indicator's inputs which will give you an idea of what the indicator can do:
Normal Candles is where you configure the replacement candles plotted by the script. You can choose from different coloring schemes for their bodies and specify a unique color for bodies where a divergence calculated using the method you choose occurs.
Volume Tops & Botttoms is where you configure the display of tops and bottoms, and their EMAs. The EMAs are calculated from the high point of tops and the low point of bottoms. They can act as a channel to evaluate price, and you can choose to color the channel using a gradient reflecting the advances/declines in the balance of your choice.
Divergence Channel is where you set up the appearance and behavior of the divergence channel. These areas represent levels where price and volume delta information do not converge. They can be interpreted as regions with no clear direction from where one will look for breaches. You can configure the channel to take into account one or both types of divergences you have configured for candle bodies and tops/bottoms.
Background allows you to configure a gradient background color that reflects the advances/declines in the balance of your choice. You can use this to provide context to the volume delta values from bars. You can also control the background color displayed on volume discrepancies between the intrabar and the chart's timeframe.
Intrabars is where you choose the calculation mode determining the lower timeframe used to access intrabars. The indicator uses the chart's timeframe and the type of market you are on to calculate the lower timeframe. Your setting there should reflect which compromise you prefer between the precision of calculations and chart coverage. This is also where you control the display of the information box in the lower right corner of the chart.
Markers allows you to control the plotting of chart markers on different conditions. Their configuration determines when alerts generated from the indicator will fire. Note that in order to generate alerts from this script, they must be created from your chart. See this Help Center page to learn how. Only the last 500 markers will be visible on the chart, but this will not affect the generation of alerts.
Periods is where you configure the periods for the balances and the EMAs used in the indicator.
The raw values calculated by this script can be inspected using the Data Window.
ββ INTERPRETATION
Rightly or wrongly, volume delta is considered by many a useful complement to the interpretation of price action. I use it extensively in an attempt to find convergence between my read of volume delta and price movement β not so much as a predictor of future price movement. No system or person can predict the future. Accordingly, I consider people who speak or act as if they know the future with certainty to be dangerous to themselves and others; they are charlatans, imprudent or blissfully ignorant.
I try to avoid elaborate volume delta interpretation schemes involving too many variables and prefer to keep things simple:
ββ’ Trends that have more chances of continuing should be accompanied by VD of the same polarity.
ββIn trends, I am looking for "slow and steady". I work from the assumption that traders and systems often overreact, which translates into unproductive volatility.
ββWild trends are more susceptible to overreactions.
ββ’ I prefer steady VD values over wildly increasing ones, as large VD increases often come with increased price volatility, which can backfire.
ββLarge VD values caused by stopping volume will also often occur on trend reversals with abnormally high candles.
ββ’ Prices escaping divergence channels may be leading a trend in that direction, although there is no telling how long that trend will last; could be just a few bars or hundreds.
ββWhen price is in a channel, shifts in VD balances can sometimes give us an idea of the direction where price has the most chance of breaking.
ββ’ Dwindling VD will often indicate trend exhaustion and predate reversals by many bars, but the problem is that mere pauses in a trend will often produce the same behavior in VD.
ββI think it is too perilous to infer rigidly from VD decreases.
Divergence Channel
Here I have configured the divergence channels to be visible. First, I set the bodies to display divergences on the default Bar Balance. They are indicated by yellow bodies. Then I activated the divergence channels by choosing to draw levels on body divergences and checked the "Fill" checkbox to fill the channel with the same color as the levels. The divergence channel is best understood as a direction-less area from where a breach can be acted on if other variables converge with the breach's direction:
Tops and Bottoms EMAs
I find these EMAs rather interesting. They have no equivalent elsewhere, as they are calculated from the top and bottom values this indicator plots. The only similarity they have with volume-weighted MAs, including VWAP, is that they use price and volume. This indicator's Tops and Bottoms EMAs, however, use the price and volume delta. While the channel differs from other channels in how it is calculated, it can be used like others, as a baseline from which to evaluate price movement or, alternatively, as stop levels. Remember that you can change the period used for the EMAs in the "Periods" section of the inputs.
This chart shows the EMAs in action, filled with a gradient representing the advances/decline from the Momentum balance. Notice the anomaly in the chart's latest bars where the Momentum balance gradient has been indicating a bullish bias for some time, during which price was mostly below the EMAs. Price has just broken above the channel on positive VD. My interpretation of this situation would be that it is a risky opportunity for a long trade in the larger context where the market has been in a downtrend since the 5th. Intrepid traders choosing to enter here could do so with a "make or break" tight stop that will minimize their losses should the market continue its downtrend while hopefully preserving the potential upside of price continuing on the longer-term uptrend prevalent since the 28th:
ββ NOTES
Volume
If you use indicators such as this one which depends on volume information, it is important to realize that the volume data they consume comes from data feeds, and that all data feeds are NOT created equally. Those who create the data feeds we use must make decisions concerning the nature of the transactions they tally and the way they are tallied in each feed, and these decisions affect the nature of our volume data. My Volume X-ray publication discusses some of the reasons why volume information from different timeframes, brokers/exchanges or sectors may vary considerably. I encourage you to read it. This indicator's display of a warning through a background color on volume discrepancies between the timeframe used to access intrabars and the chart's timeframe is an attempt to help you realize these variations in feeds. Don't take things for granted, and understand that the quality of a given feed's volume information affects the quality of the results this indicator calculates.
Markets as ecosystems
I believe it is perilous to think that behavioral patterns you discover in one market through the lens of this or any other indicator will necessarily port to other markets. While this may sometimes be the case, it will often not. Why is that? Because each market is its own ecosystem. As cities do, all markets share some common characteristics, but they also all have their idiosyncrasies. A proportion of a city's inhabitants is always composed of outsiders who come and go, but a core population of regulars and systems is usually the force that actually defines most of the city's observable characteristics. I believe markets work somewhat the same way; they may look the same, but if you live there for a while and pay attention, you will notice the idiosyncrasies. Some things that work in some markets will, accordingly, not work in others. Please keep that in mind when you draw conclusions.
On Up/Down or Buy/Sell Volume
Buying or selling volume are misnomers, as every unit of volume transacted is both bought and sold by two different traders. While this does not keep me from using the terms, there is no such thing as βbuy onlyβ or βsell onlyβ volume. Trader lingo is riddled with peculiarities. Without access to order book information, traders work with the assumption that when price moves up during a bar, there was more buying pressure than selling pressure, just as when buy market orders take out limit ask orders in the order book at successively higher levels. The built-in volume indicator available on TradingView uses this logic to color the volume columns green or red. While this scriptβs calculations are more precise because it analyses intrabars to calculate its information, it uses pretty much the same imperfect logic. Until Pine scripts can have access to how much volume was transacted at the bid/ask prices, our volume delta calculations will remain a mere proxy.
Repainting
ββ’ The values calculated on the realtime bar will update as new information comes from the feed.
ββ’ Historical values may recalculate if the historical feed is updated or when calculations start from a new point in history.
ββ’ Markers and alerts will not repaint as they only occur on a bar's close. Keep this in mind when viewing markers on historical bars,
ββwhere one could understandably and incorrectly assume they appear at the bar's open.
To learn more about repainting, see the Pine Scriptβ’ User Manual's page on the subject .
Superfluity
In "The Bed of Procrustes", Nassim Nicholas Taleb writes: To bankrupt a fool, give him information . This indicator can display a lot of information. The inevitable adaptation period you will need to figure out how to use it should help you eliminate all the visuals you do not need. The more you eliminate, the easier it will be to focus on those that are the most useful to your trading practice. Don't be a fool.
ββ THANKS
Thanks to alexgrover for his Dekidaka-Ashi indicator. His volume plots on candles were the inspiration for my top/bottom plots.
Kudos to PineCoders for their libraries. I use two of them in this script: Time and lower_tf .
The first versions of this script used functionality that I would not have known about were it not for these two guys:
β A guy called Kuan who commented on a Backtest Rookies presentation of their Volume Profile indicator.
β theheirophant , my partner in the exploration of the sometimes weird abysses of request.security() βs behavior at lower timeframes.
Lockin Strength Indicator (LSI)How It Works:
RSI Calculation: The standard RSI is calculated using a 14-period by default.
Volume Weighting: If enabled, the LSI modifies the RSI by weighting it based on the volume relative to its moving average. This emphasizes periods of high or low volume, which can be particularly useful for Solana-based assets that might have unique volume profiles.
Plotting: The LSI is plotted with standard overbought and oversold levels, and background highlighting makes these areas visually distinct.
Customization:
RSI Length: You can adjust the length of the RSI period.
Overbought/Oversold Levels: You can modify the levels for overbought and oversold signals.
Volume Weighting: You can toggle volume weighting on or off.
This indicator is designed to give you a more nuanced view of Solana cryptocurrencies by combining RSI with volume dynamics.
Volume Forks [Trendoscope]π² Volume Forks - Advanced Price Analysis with Recursive Auto-Pitchfork and Angled Volume Profile
The Volume Forks Indicator is a comprehensive research tool that combines two innovative techniques, Recursive Auto-Pitchfork and Angled Volume Profile . This indicator provides traders with valuable insights into price dynamics by integrating accurate pitchfork drawing and volume analysis over angled levels. The indicator does following things
Detects Pitchfork formations automatically on the chart over Recursive Zigzag
Instead of drawing forks based on fib levels, volume distribution over ABC of pitchfork is calculated and drawn in the direction of the handle.
π² Brief about Pitchfork
Pitchfork is drawn when price forms ABC pattern. Pitchfork draws a series of parallel lines in the direction of trend which can be used for support and resistance.
There are many methods of drawing pitchfork. In all cases, a line joining BβCβ will make the base of pitchfork and fork lines are drawn from different points of the base. All the fork lines will be parallel. But, the handle of the base defines the direction of fork lines. Classification of pitchfork is mainly based on the starting and ending points of the handle.
π² Regular Types
Here, end of the handle is always fixed and it will be the mid point of B and C.
π― Andrews Pitchfork
Handle starts from A and joins the base at mid of B and C.
Forks are drawn based on fib ratios from the handle
π― Schiff Pitchfork
Handle starts from Bar of A and price of middle of AB and joins the base at mid of B and C
Forks are drawn based on fib ratios from the handle
π― Modified Schiff Pitchfork
Handle starts from mid of A and B and joins the base at mid of B and C
Forks are drawn based on fib ratios from the handle
π² Inside Types
Here, C will act as end of the handle which joins the Base BβCβ.
π― Andrews Pitchfork (Inside)
Handle starts from A and joins the base at C
Forks are drawn based on fib ratios from the handle
π― Schiff Pitchfork (Inside)
Handle starts from Bar of A and price of (A+B)/2 and joins the base at C
Forks are drawn based on fib ratios from the handle
π― Modified Schiff Pitchfork (Inside)
Handle starts from mid of A and B and joins the base at C
Forks are drawn based on fib ratios from the handle
π² Brief about Pitchfork
The Angled Volume Profile technique expands on the concept of volume profile by measuring volume distribution levels over angled levels rather than just horizontal levels. By selecting a starting point and angle interactively, traders can assess volume distribution within specific price trends. This feature is particularly useful for analysing volume dynamics in trending markets.
π² Settings
Indicator settings include few things which determine the scanning of pitchforks and few which determines drawing of volume profile lines.
Please note that, due to pine limitations of 500 lines, if there are too many formations on the chart, volume profile may not appear correctly. If that happens, please reduce the number of volume forks per formation.
Simplified Market ProfileVolume Bins: This script divides the price range into num_bins equal price levels. Each bin holds the cumulative volume for that price range.
Profile Length: The number of past bars that the profile considers for building the volume histogram.
Bin Size: The price range between bins is determined by dividing the difference between the highest and lowest prices over the specified range.
Volume Calculation: The script iterates over each bar within the specified range, determining which price bin the barβs volume should be added to.
Plotting: The script visualizes the volume profile as lines plotted horizontally at different price levels, with thickness proportional to the volume traded at that level.
CVD - Cumulative Volume Delta (Chart)β β OVERVIEW
This indicator displays cumulative βvolume delta (βCVD) as an on-chart oscillator. It uses intrabar analysis to obtain more precise βvolume delta information compared to methods that only use the chart's timeframe.
The core concepts in this script come from our first β CVD indicator , which displays CVDβ values as plot candles in a separate indicator pane. In this script, CVβD values are scaled according to price ranges and represented on the main chart pane.
β β CONCEPTS
Bar polarity
Bar polarity refers to the position of the close price relative to the open price. In other words, bar polarity is the direction of price change.
Intrabars
Intrabars are chart bars at a lower timeframe than the chart's. Each 1H chart bar of a 24x7 market will, for example, usually contain 60 bars at the lower timeframe of 1min, provided there was market activity during each minute of the hour. Mining information from intrabars can be useful in that it offers traders visibility on the activity inside a chart bar.
Lower timeframes (LTFs)
A lower timeframe is a timeframe that is smaller than the chart's timeframe. This script utilizes a LTF to analyze intrabars, or price changes within a chart bar. The lower the βLTF, the more intrabars are analyzed, but the less chart bars can display information due to the limited number of intrabars that can be analyzed.
Volume delta
Volume delta is a measure that separates βvolumeβ into "up" and "down" parts, then takes the difference to estimate the net demand for the asset. This approach gives traders a more detailed insight when analyzing volumeβ and market sentiment. There are several methods for determining whether an asset's volumeβ belongs in the "up" or "down" category. Some indicators, such as On Balance Volumeβ and the Klinger Oscillator , use the change in price between bars to assign βvolumeβ values to the appropriate category. Others, such as Chaikin Money Flow , make assumptions based on open, high, low, and close prices. The most accurate method involves using tick data to determine whether each transaction occurred at the bid or ask price and assigning the βvolumeβ value to the appropriate category accordingly. However, this method requires a large amount of data on historical bars, which can limit the historical depth of charts and the number of symbols for which tick data is available.
In the context where historical tick data is not yet available on TradingView, intrabar analysis is the most precise technique to calculate βvolume delta on historical bars on our charts. This indicator uses intrabar analysis to achieve a compromise between simplicity and accuracy in calculating βvolume delta on historical bars. Our Volume Profile indicators use it as well. Other βvolume delta indicators in our Community Scripts , such as the Realtime 5D Profile , use real-time chart updates to achieve more precise βvolume delta calculations. However, these indicators aren't suitable for analyzing historical bars since they only work for real-time analysis.
This is the logic we use to assign intrabar βvolume to the "up" or "down" category:
ββ’ If the intrabar's open and close values are different, their relative position is used.
ββ’ If the intrabar's open and close values are the same, the difference between the intrabar's close and the previous intrabar's close is used.
ββ’ As a last resort, when there is no movement during an intrabar and it closes at the same price as the previous intrabar, the last known polarity is used.
Once all intrabars comprising a chart bar are analyzed, we calculate the net difference between "up" and "down" intrabar volumeβ to produce the volumeβ delta for the chart bar.
β β FEATURES
CVD resets
The "cumulative" part of the indicator's name stems from the fact that calculations accumulate during a period of time. By periodically resetting the volumeβ delta accumulation, we can analyze the progression of βvolume delta across manageable chunks, which is often more useful than looking at βvolume delta accumulated from the beginning of a chart's history.
You can configure the reset period using the "CVD Resets" input, which offers the following selections:
ββ’ None : Calculations do not reset.
ββ’ On a fixed higher timeframe : Calculations reset on the higher timeframe you select in the "Fixed higher timeframe" field.
ββ’ At a fixed time that you specify.
ββ’ At the beginning of the regular session .
ββ’ On trend changes : Calculations reset on the direction change of either the Aroon indicator, Parabolic SAR , or Supertrend .
ββ’ On a stepped higher timeframe : Calculations reset on a higher timeframe automatically stepped using the chart's timeframe and following these rules:
Chart TF βHTF
< 1min 1H
< 3H 1D
<= 12H 1W
< 1W 1M
>= 1W 1Y
Specifying intrabar precision
Ten options are included in the script to control the number of intrabars used per chart bar for calculations. The greater the number of intrabars per chart bar, the fewer chart bars can be analyzed.
The first five options allow users to specify the approximate amount of chart bars to be covered:
ββ’ Least Precise (Most chart bars) : Covers all chart bars by dividing the current timeframe by four.
ββThis ensures the highest level of intrabar precision while achieving complete coverage for the dataset.
ββ’ Less Precise (Some chart bars) & More Precise (Less chart bars) : These options calculate a stepped βLTF in relation to the current chart's timeframe.
ββ’ Very precise (2min intrabars) : Uses the second highest quantity of intrabars possible with the 2min βLTF.
ββ’ Most precise (1min intrabars) : Uses the maximum quantity of intrabars possible with the 1min βLTF.
The stepped lower timeframe for "Less Precise" and "More Precise" options is calculated from the current chart's timeframe as follows:
Chart Timeframe Lower Timeframe
Less Precise More Precise
< 1hr 1min 1min
< 1D 15min 1min
< 1W β2hrβ 30min
> 1W 1D 60min
The last five options allow users to specify an approximate fixed number of intrabars to analyze per chart bar. The available choices are 12, 24, 50, 100, and 250. The script will calculate the LTFβ which most closely approximates the specified number of intrabars per chart bar. Keep in mind that due to factors such as the length of a ticker's sessions and rounding of the LTFβ, it is not always possible to produce the exact number specified. However, the script will do its best to get as close to the value as possible.
As there is a limit to the number of intrabars that can be analyzed by a script, a tradeoff occurs between the number of intrabars analyzed per chart bar and the chart bars for which calculations are possible.
Display
This script displays raw or cumulative volumeβ delta values on the chart as either line or histogram oscillator zones scaled according to the price chart, allowing traders to visualize volumeβ activity on each bar or cumulatively over time. The indicator's background shows where CVDβ resets occur, demarcating the beginning of new zones. The vertical axis of each oscillator zone is scaled relative to the one with the highest price range, and the oscillator values are scaled relative to the highest volumeβ delta. A vertical offset is applied to each oscillator zone so that the highest oscillator value aligns with the lowest price. This method ensures an accurate, intuitive visual comparison of volumeβ activity within zones, as the scale is consistent across the chart, and oscillator values sit below prices. The vertical scale of oscillator zones can be adjusted using the "Zone Height" input in the script settings.
This script displays labels at the highest and lowest oscillator values in each zone, which can be enabled using the "Hi/Lo Labels" input in the "Visuals" section of the script settings. Additionally, the oscillator's value on a chart bar is displayed as a tooltip when a user hovers over the bar, which can be enabled using the "Value Tooltips" input.
Divergences occur when the polarity of βvolume delta does not match that of the chart bar. The script displays divergences as bar colors and background colors that can be enabled using the "Color bars on divergences" and "Color background on divergences" inputs.
An information box in the lower-left corner of the indicator displays the HTF used for resets, the βLTF used for intrabars, the average quantity of intrabars per chart bar, and the number of chart bars for which there is LTF data. This is enabled using the "Show information box" input in the "Visuals" section of the script settings.
FOR Pine Scriptβ’ CODERS
ββ’ This script utilizes `ltf()` and `ltfStats()` from the lower_tf library.
ββThe `ltf()` function determines the appropriate lower timeframe from the selected calculation mode and chart timeframe, and returns it in a format that can be used with request.security_lower_tf() .
ββThe `ltfStats()` function, on the other hand, is used to compute and display statistical information about the lower timeframe in an information box.
ββ’ The script utilizes display.data_window and display.status_line to restrict the display of certain plots.
ββThese new built-ins allow coders to fine-tune where a scriptβs plot values are displayed.
ββ’ The newly added session.isfirstbar_regular built-in allows for resetting the βCVD segments at the start of the regular session.
ββ’ The VisibleChart library developed by our resident PineCoders team leverages the chart.left_visible_bar_time and chart.right_visible_bar_time variables to optimize the performance of this script.
ββThese variables identify the opening time of the leftmost and rightmost visible bars on the chart, allowing the script to recalculate and draw objects only within the range of visible bars as the user scrolls.
ββThis functionality also enables the scaling of the oscillator zones.
ββThese variables are just a couple of the many new built-ins available in the chart.* namespace.
ββFor more information, check out this blog post or look them up by typing "chart." in the Pine Scriptβ’ Reference Manual .
ββ’ Our ta library has undergone significant updates recently, including the incorporation of the `aroon()` indicator used as a method for resetting βCVD segments within this script.
ββRevisit the library to see more of the newly added content!
Look first. Then leap.
Delta Volume Channels [LucF]ββ OVERVIEW
This indicator displays on-chart visuals aimed at making the most of delta βvolume information. It can color bars and display two channels: one for delta βvolume, another calculated from the price levels of bars where delta βvolume divergences occur. Markers and alerts can also be configured using key conditions, and filtered in many different ways. The indicator caters to traders who prefer chart visuals over raw values. It will work on historical bars and in real time, using intrabar analysis to calculate delta βvolume in both conditions.
ββ CONCEPTS
Delta Volume
βThe βvolume delta concept divides a bar's βvolume in "up" and "down" βvolumes. The delta is calculated by subtracting down βvolume from up βvolume. Many calculation techniques exist to isolate up and down βvolume within a bar. The simplest techniques use the polarity of interbar price changes to assign their βvolume to up or down slots, e.g., On Balance Volume or the Klinger Oscillator . Others such as Chaikin Money Flow use assumptions based on a bar's OHLC values. The most precise calculation method uses tick data and assigns the βvolume of each tick to the up or down slot depending on whether the transaction occurs at the bid or ask price. While this technique is ideal, it requires huge amounts of data on historical bars, which usually limits the historical depth of charts and the number of symbols for which tick data is available.
This indicator uses intrabar analysis to achieve a compromise between the simplest and most precise methods of calculating βvolume delta. In the context where historical tick data is not yet available on TradingView, intrabar analysis is the most precise technique to calculate βvolume delta on historical bars on our charts. TradingView's Volume Profile built-in indicators use it, as do the CVD - Cumulative βVolume Delta Candles and CVD - Cumulative Volume Delta (Chart) indicators published from the TradingView account . My Volume Delta Columns Pro indicator also uses intrabar analysis. Other βvolume delta indicators such as my Realtime 5D Profile use realtime chart updates to achieve more precise βvolume delta calculations. Indicators of that type cannot be used on historical bars however; they only work in real time.
This is the logic I use to assign intrabar βvolume to up or down slots:
ββ’ If the intrabar's open and close values are different, their relative position is used.
ββ’ If the intrabar's open and close values are the same, the difference between the intrabar's close and the previous intrabar's close is used.
ββ’ As a last resort, when there is no movement during an intrabar and it closes at the same price as the previous intrabar, the last known polarity is used.
Once all intrabars making up a chart bar have been analyzed and the up or down property of each intrabar's βvolume determined, the up volumes are added and the down volumes subtracted. The resulting value is βvolume delta for that chart bar, which can be used as an estimate of the buying/selling pressure on an instrument.
Delta βVolume Percent (DV%)
This value is the proportion that delta βvolume represents of the total intrabar βvolume in the chart bar. Note that on some symbols/timeframes, the total intrabar βvolume may differ from the chart's βvolume for a bar, but that will not affect our calculations since we use the total intrabar βvolume.
Delta βVolume Channel
The ββDV channel is the space between two moving averages: the reference line and a DV%-weighted version of that reference. The reference line is a moving average of a type, source and length which you select. The DV%-weighted line uses the same settings, but it averages the DV%-weighted price source.
The weight applied to the source of the reference line is calculated from two values, which are multiplied: DV% and the relative size of the bar's βvolume in relation to previous bars. The effect of this is that DV% values on bars with higher total βvolume will carry greater weight than those with lesser βvolume.
The βDV channel can be in one of four states, each having its corresponding color:
ββ’ Bull (teal): The DV%-weighted line is above the reference line.
ββ’ Strong bull (lime): The bull condition is fulfilled and the bar's close is above the reference line and both the reference and the DV%-weighted lines are rising.
ββ’ Bear (maroon): The DV%-weighted line is below the reference line.
ββ’ Strong bear (pink): The bear condition is fulfilled and the bar's close is below the reference line and both the reference and the DV%-weighted lines are falling.
Divergences
In the context of this indicator, a divergence is any bar where the slope of the reference line does not match that of the DV%-weighted line. No directional bias is assigned to divergences when they occur.
Divergence Channel
The divergence channel is the space between two levels (by default, the bar's low and high ) saved when divergences occur. When price has breached a channel and a new divergence occurs, a new channel is created. Until that new channel is breached, bars where additional divergences occur will expand the channel's levels if the bar's price points are outside the channel.
Prices breaches of the divergence channel will change its state. Divergence channels can be in one of five different states:
ββ’ Bull (teal): Price has breached the channel to the upside.
ββ’ Strong bull (lime): The bull condition is fulfilled and the βDV channel is in the strong bull state.
ββ’ Bear (maroon): Price has breached the channel to the downside.
ββ’ Strong bear (pink): The bear condition is fulfilled and the βDV channel is in the strong bear state.
ββ’ Neutral (gray): The channel has not been breached.
ββ HOW TO USE THE INDICATOR
Load the indicator on an active chart (see here if you don't know how).
The default configuration displays:
ββ’ The βDV channel, without the reference or DV%-weighted lines.
ββ’ The Divergence channel, without its level lines.
ββ’ Bar colors using the state of the βDV channel.
The default settings use an Arnaud-Legoux moving average on the close and a length of 20 bars. The DV%-weighted version of it uses a combination of DV% and relative βvolume to calculate the ultimate weight applied to the reference. The DV%-weighted line is capped to 5 standard deviations of the reference. The lower timeframe used to access intrabars automatically adjusts to the chart's timeframe and achieves optimal balance between the number of intrabars inspected in each chart bar, and the number of chart bars covered by the script's calculations.
The Divergence channel's levels are determined using the high and low of the bars where divergences occur. Breaches of the channel require a bar's low to move above the top of the channel, and the bar's high to move below the channel's bottom.
No markers appear on the chart; if you want to create alerts from this script, you will need first to define the conditions that will trigger the markers, then create the alert, which will trigger on those same conditions.
To learn more about how to use this indicator, you must understand the concepts it uses and the information it displays, which requires reading this description. There are no videos to explain it.
ββ FEATURES
The script's inputs are divided in four sections: "DV channel", "Divergence channel", "Other Visuals" and "Marker/Alert Conditions". The first setting is the selection method used to determine the intrabar precision, i.e., how many lower timeframe bars (intrabars) are examined in each chart bar. The more intrabars you analyze, the more precise the calculation of DV% results will be, but the less chart coverage can be covered by the script's calculations.
DV Channel
Here, you control the visibility and colors of the reference line, its weighted version, and the DV channel between them.
You also specify what type of moving average you want to use as a reference line, its source and length. This acts as the βDV channel's baseline. The DV%-weighted line is also a moving average of the same type and length as the reference line, except that it will be calculated from the DV%-weighted source used in the reference line. By default, the DV%-weighted line is capped to five standard deviations of the reference line. You can change that value here. This section is also where you can disable the relative βvolume component of the weight.
Divergence Channel
This is where you control the appearance of the divergence channel and the key price values used in determining the channel's levels and breaching conditions. These choices have an impact on the behavior of the channel. More generous level prices like the default low and high selection will produce more conservative channels, as will the default choice for breach prices.
In this section, you can also enable a mode where an attempt is made to estimate the channel's bias before price breaches the channel. When it is enabled, successive increases/decreases of the channel's top and bottom levels are counted as new divergences occur. When one count is greater than the other, a bull/bear bias is inferred from it.
Other Visuals
You specify here:
ββ’ The method used to color chart bars, if you choose to do so.
ββ’ The display of a mark appearing above or below bars when a divergence occurs.
ββ’ If you want raw values to appear in tooltips when you hover above chart bars. The default setting does not display them, which makes the script faster.
ββ’ If you want to display an information box which by default appears in the lower left of the chart.
ββIt shows which lower timeframe is used for intrabars, and the average number of intrabars per chart bar.
Marker/Alert Conditions
Here, you specify the conditions that will trigger up or down markers. The trigger conditions can include a combination of state transitions of the βDV and the divergence channels. The triggering conditions can be filtered using a variety of conditions.
Configuring the marker conditions is necessary before creating an alert from this script, as the alert will use the marker conditions to trigger.
Markers only appear on bar closes, so they will not repaint. Keep in mind, when looking at markers on historical bars, that they are positioned on the bar when it closes β NOT when it opens.
Raw values
The raw values calculated by this script can be inspected using a tooltip and the Data Window. The tooltip is visible when you hover over the top of chart bars. It will display on the last 500 bars of the chart, and shows the values of βDV, DV%, the combined weight, and the intermediary values used to calculate them.
ββ INTERPRETATION
The aim of the βDV channel is to provide a visual representation of the buying/selling pressure calculated using delta βvolume. The simplest characteristic of the channel is its bull/bear state. One can then distinguish between its bull and strong bull states, as transitions from strong bull to bull states will generally happen when buyers are losing steam. While one should not infer a reversal from such transitions, they can be a good place to tighten stops. Only time will tell if a reversal will occur. One or more divergences will often occur before reversals.
The nature of the divergence channel's design makes it particularly adept at identifying consolidation areas if its settings are kept on the conservative side. A gray divergence channel should usually be considered a no-trade zone. More adventurous traders can use the βDV channel to orient their trade entries if they accept the risk of trading in a neutral divergence channel, which by definition will not have been breached by price.
If your charts are already busy with other stuff you want to hold on to, you could consider using only the chart bar coloring component of this indicator:
At its simplest, one way to use this indicator would be to look for overlaps of the strong bull/bear colors in both the βDV channel and a divergence channel, as these identify points where price is breaching the divergence channel when buy/sell pressure is consistent with the direction of the breach. I have highlighted all those points in the chart below. Not all of them would have produced profitable trades, but nothing is perfect in the markets. Also, keep in mind that the circles identify the visual you would be looking for β not the trade's entry level.
ββ LIMITATIONS
ββ’ The script will not work on symbols where no βvolume is available. An error will appear when that is the case.
ββ’ Because a maximum of 100K intrabars can be analyzed by a script, a compromise is necessary between the number of intrabars analyzed per chart bar
ββand chart coverage. The more intrabars you analyze per chart bar, the less coverage you will obtain.
ββThe setting of the "Intrabar precision" field in the "DV channel" section of the script's inputs
ββis where you control how the lower timeframe is calculated from the chart's timeframe.
ββ NOTES
Volume Quality
If you use βvolume, it's important to understand its nature and quality, as it varies with sectors and instruments. My Volume X-ray indicator is one way you can appraise the quality of an instrument's intraday βvolume.
For Pine Scriptβ’ Coders
ββ’ This script uses the new overload of the fill() function which now makes it possible to do vertical gradients in Pine. I use it for both channels displayed by this script.
ββ’ I use the new arguments for plot() 's `display` parameter to control where the script plots some of its values,
ββnamely those I only want to appear in the script's status line and in the Data Window.
ββ’ I wrote my script using the revised recommendations in the Style Guide from the Pine v5 User Manual.
ββ THANKS
To PineCoders . I have used their lower_tf library in this script, to manage the calculation of the LTF and intrabar stats, and their Time library to convert a timeframe in seconds to a printable form for its display in the Information box.
To TradingView's Pine Scriptβ’ team. Their innovations and improvements, big and small, constantly expand the boundaries of the language. What this script does would not have been possible just a few months back.
And finally, thanks to all the users of my scripts who take the time to comment on my publications and suggest improvements. I do not reply to all but I do read your comments and do my best to implement your suggestions with the limited time that I have.
Bitcoin Stalemate IndicatorThe Bitcoin Stalemate Indicator examines periods in the market defined by a combination of high volume and low price volatility. These periods are a bit like a tug-of-war with both sides applying a lot of force but the rope moving very little. Periods of high volume and low volatility suggest both sides of the trade are stuck in a stalemate. This indicator may be useful in identifying psychologically important price levels.
The mechanics of the indicator are fairly simple: the indicator takes the volume and divides it by the candleβs size over itβs close for that same period.
volume / ((high - low) / close)
Candles that move very little but with high volume will produce higher reads and vice versa. Finally a smoothing average is applied to clean up the noise.
Volume profiles from the top 6 exchanges are averaged in order to avoid a single exchangeβs popularity acting as an overriding factor. Single exchanges can be isolated but are of lesser use. Heat map functionality is only active when all exchanges are selected.
CVD - Cumulative Volume Delta Candlesβ β OVERVIEW
This indicator displays cumulative βvolume delta in candle form. It uses intrabar information to obtain more precise βvolume delta information than methods using only the chart's timeframe.
β β CONCEPTS
Bar polarity
By bar polarity , we mean the direction of a bar, which is determined by looking at the bar's close vs its open .
Intrabars
Intrabars are chart bars at a lower timeframe than the chart's. Each 1H chart bar of a 24x7 market will, for example, usually contain 60 bars at the lower timeframe of 1min, provided there was market activity during each minute of the hour. Mining information from intrabars can be useful in that it offers traders visibility on the activity inside a chart bar.
Lower timeframes (LTFs)
A lower timeframe is a timeframe that is smaller than the chart's timeframe. This script uses a βLTF to access intrabars. The lower the βLTF, the more intrabars are analyzed, but the less chart bars can display βCVD information because there is a limit to the total number of intrabars that can be analyzed.
Volume delta
The βvolume delta concept divides a bar's βvolume in "up" and "down" βvolumes. The delta is calculated by subtracting down βvolume from up βvolume. Many calculation techniques exist to isolate up and down βvolume within a bar. The simplest techniques use the polarity of interbar price changes to assign their βvolume to up or down slots, e.g., On Balance Volume or the Klinger Oscillator . Others such as Chaikin Money Flow use assumptions based on a bar's OHLC values. The most precise calculation method uses tick data and assigns the βvolume of each tick to the up or down slot depending on whether the transaction occurs at the bid or ask price. While this technique is ideal, it requires huge amounts of data on historical bars, which usually limits the historical depth of charts and the number of symbols for which tick data is available.
This indicator uses intrabar analysis to achieve a compromise between the simplest and most precise methods of calculating βvolume delta. In the context where historical tick data is not yet available on TradingView, intrabar analysis is the most precise technique to calculate βvolume delta on historical bars on our charts. Our Volume Profile indicators use it. Other βvolume delta indicators in our Community Scripts such as the Realtime 5D Profile use realtime chart updates to achieve more precise βvolume delta calculations, but that method cannot be used on historical bars, so those indicators only work in real time.
This is the logic we use to assign intrabar βvolume to up or down slots:
ββ’ If the intrabar's open and close values are different, their relative position is used.
ββ’ If the intrabar's open and close values are the same, the difference between the intrabar's close and the previous intrabar's close is used.
ββ’ As a last resort, when there is no movement during an intrabar and it closes at the same price as the previous intrabar, the last known polarity is used.
Once all intrabars making up a chart bar have been analyzed and the up or down property of each intrabar's βvolume determined, the up volumes are added and the down volumes subtracted. The resulting value is βvolume delta for that chart bar.
β β FEATURES
CVD Candles
Cumulative βVolume Delta Candles present βvolume delta information as it evolves during a period of time.
This is how each candle's levels are calculated:
ββ’ open : Each candle's' open level is the cumulative βvolume delta for the current period at the start of the bar.
ββThis value becomes zero on the first candle following a βCVD reset.
ββThe candles after the first one always open where the previous candle closed.
ββThe candle's high, low and close levels are then calculated by adding or subtracting a βvolume value to the open.
ββ’ high : The highest ββvolume delta value found in intrabars. If it is not higher than the βvolume delta for the bar, then that candle will have no upper wick.
ββ’ low : The lowest ββvolume delta value found in intrabars. If it is not lower than the βvolume delta for the bar, then that candle will have no lower wick.
ββ’ close : The aggregated βvolume delta for all intrabars. If βvolume delta is positive for the chart bar, then the candle's close will be higher than its open, and vice versa.
The candles are plotted in one of two configurable colors, depending on the polarity of βvolume delta for the bar.
CVD resets
The "cumulative" part of the indicator's name stems from the fact that calculations accumulate during a period of time. This allows you to analyze the progression of βvolume delta across manageable chunks, which is often more useful than looking at βvolume delta cumulated from the beginning of a chart's history.
You can configure the reset period using the "CVD Resets" input, which offers the following selections:
ββ’ None : Calculations do not reset.
ββ’ On a fixed higher timeframe : Calculations reset on the higher timeframe you select in the "Fixed higher timeframe" field.
ββ’ At a fixed time that you specify.
ββ’ At the beginning of the regular session .
ββ’ On a stepped higher timeframe : Calculations reset on a higher timeframe automatically stepped using the chart's timeframe and following these rules:
Chart TF βHTF
< 1min 1H
< 3H 1D
<= 12H 1W
< 1W 1M
>= 1W 1Y
The indicator's background shows where resets occur.
Intrabar precision
The precision of calculations increases with the number of intrabars analyzed for each chart bar. It is controlled through the script's "Intrabar precision" input, which offers the following selections:
ββ’ Least precise, covering many chart bars
ββ’ Less precise, covering some chart bars
ββ’ More precise, covering less chart bars
ββ’ Most precise, 1min intrabars
As there is a limit to the number of intrabars that can be analyzed by a script, a tradeoff occurs between the number of intrabars analyzed per chart bar and the chart bars for which calculations are possible.
Total βvolume candles
You can choose to display candles showing the total intrabar βvolume for the chart bar. This provides you with more context to evaluate a bar's βvolume delta by showing it relative to the sum of intrabar βvolume. Note that because of the reasons explained in the "NOTES" section further down, the total βvolume is the sum of all intrabar ββvolume rather than the βvolume of the bar at the chart's timeframe.
Total βvolume candles can be configured with their own up and down colors. You can also control the opacity of their bodies to make them more or less prominent. This publication's chart shows the indicator with total βvolume candles. They are turned off by default, so you will need to choose to display them in the script's inputs for them to plot.
Divergences
Divergences occur when the polarity of βvolume delta does not match that of the chart bar. You can identify divergences by coloring the βCVD candles differently for them, or by coloring the indicator's background.
Information box
An information box in the lower-left corner of the indicator displays the HTF used for resets, the βLTF used for intrabars, and the average quantity of intrabars per chart bar. You can hide the box using the script's inputs.
β β INTERPRETATION
The first thing to look at when analyzing βCVD candles is the side of the zero line they are on, as this tells you if βCVD is generally βbullish or βbearish. Next, one should consider the relative position of successive candles, just as you would with a price chart. Are successive candles trending up, down, or stagnating? Keep in mind that whatever trend you identify must be considered in the context of where it appears with regards to the zero line; an uptrend in a negative βCVD (below the zero line) may not be as powerful as one taking place in positive βCVD values, but it may also predate a movement into positive βCVD territory. The same goes with stagnation; a trader in a long position will find stagnation in positive βCVD territory less worrisome than stagnation under the zero line.
After consideration of the bigger picture, one can drill down into the details. Exactly what you are looking for in markets will, of course, depend on your trading methodology, but you may find it useful to:
β β’ Evaluate βvolume delta for the bar in relation to price movement for that bar.
β β’ Evaluate the proportion that ββvolume delta represents of total βvolume.
β β’ Notice divergences and if the chart's candle shape confirms a hesitation point, as a Doji would.
β β’ Evaluate if the progress of βCVD candles correlates with that of chart bars.
β β’ Analyze the wicks. As with price candles, long wicks tend to indicate weakness.
Always keep in mind that unless you have chosen not to reset it, your βCVD resets for each period, whether it is fixed or automatically stepped. Consequently, any trend from the preceding period must re-establish itself in the next.
β β NOTES
Know your volume
Traders using βvolume information should understand the βvolume data they are using: where it originates and what transactions it includes, as this can vary with instruments, sectors, exchanges, timeframes, and between historical and realtime bars. The information used to build a chart's bars and display βvolume comes from data providers (exchanges, brokers, etc.) who often maintain distinct feeds for intraday and βend-of-day (βEOD) timeframes. How βvolume data is assembled for the two feeds depends on how instruments are traded in that sector and/or the βvolume reporting policy for each feed. Instruments from crypto and forex markets, for example, will often display similar βvolume on both feeds. Stocks will often display variations because block trades or other types of trades may not be included in their intraday βvolume data. βFutures will also typically display variations.
Note that as intraday vs βEOD variations exist for historical bars on some instruments, differences may also exist between the realtime feeds used on intraday vs 1D or greater timeframes for those same assets. Realtime reporting rules will often be different from historical feed reporting rules, so variations between realtime feeds will often be different from the variations between historical feeds for the same instrument. The Volume X-ray indicator can help you analyze differences between intraday and βEOD βvolumes for the instruments you trade.
If every unit of βvolume is both bought by a buyer and sold by a seller, how can βvolume delta make sense?
Traders who do not understand the mechanics of matching engines (the exchange software that matches orders from buyers and sellers) sometimes argue that the concept of βvolume delta is flawed, as every unit of βvolume is both bought and sold. While they are rigorously correct in stating that every unit of βvolume is both bought and sold, they overlook the fact that information can be mined by analyzing variations in the price of successive ticks, or in our case, intrabars.
Our calculations model the situation where, in fully automated order handling, market orders are generally matched to limit orders sitting in the order book. Buy market orders are matched to quotes at the ask level and sell market orders are matched to quotes at the bid level. As explained earlier, we use the same logic when comparing intrabar prices. While using intrabar analysis does not produce results as precise as when individual transactions β or ticks β are analyzed, results are much more precise than those of methods using only chart prices.
Not only does the concept underlying βvolume delta make sense, it provides a window on an oft-overlooked variable which, with price and time, is the only basic information representing market activity. Furthermore, because the calculation of βvolume delta also uses price and time variations, one could conceivably surmise that it can provide a more complete model than ones using price and time only. Whether or not βvolume delta can be useful in your trading practice, as usual, is for you to decide, as each trader's methodology is different.
For Pine Scriptβ’ coders
As our latest Polarity Divergences publication, this script uses the recently released request.security_lower_tf() Pine Scriptβ’ function discussed in this blog post . It works differently from the usual request.security() in that it can only be used at LTFs, and it returns an array containing one value per intrabar. This makes it much easier for programmers to access intrabar information.
Look first. Then leap.
Delta Volume Columns Pro [LucF]ββ OVERVIEW
This indicator displays volumeββ delta information calculated with intrabar inspection on historical bars, and feed updates when running in realtime. It is designed to run in a pane and can display either stacked buy/sell volumeβ columns or a signal line which can be calculated and displayed in many different ways.
Five different models are offered to reveal different characteristics of the calculated volumeβ delta information. Many options are offered to visualize the calculations, giving you much leeway in morphing the indicator's visuals to suit your needs. If you value delta volumeβ information, I hope you will find the time required to master Delta Volumeβ Columns Pro well worth the investment. I am confident that if you combine a proper understanding of the indicator's information with an intimate knowledge of the volumeβ idiosyncrasies on the markets you trade, you can extract useful market intelligence using this tool.
ββ WARNINGS
1. The indicator only works on markets where volumeβ information is available,
ββPlease validate that your symbol's feed carries volumeβ information before asking me why the indicator doesn't plot values.
2. When you refresh your chart or re-execute the script on the chart, the indicator will repaint because elapsed realtime bars will then recalculate as historical bars.
3. Because the indicator uses different modes of calculation on historical and realtime bars, it's critical that you understand the differences between them. Details are provided further down.
4. Calculations using intrabar inspection on historical bars can only be done from some chart timeframes. See further down for a list of supported timeframes.
ββIf the chart's timeframe is not supported, no historical volumeβ delta will display.
ββ CONCEPTS
Chart bars
Three different types of bars are used in charts:
β1. Historical bars are bars that have already closed when the script executes on them.
β2. The realtime bar is the current, incomplete bar where a script is running on an open market. There is only one active realtime bar on your chart at any given time.
βββThe realtime bar is where alerts trigger.
β3. Elapsed realtime bars are bars that were calculated when they were realtime bars but have since closed.
βββWhen a script re-executes on a chart because the browser tab is refreshed or some of its inputs are changed, elapsed realtime bars are recalculated as historical bars.
Why does this indicator use two modes of calculation?
Historical bars on TradingView charts contain OHLCV data only, which is insufficient to calculate volumeβ delta on them with any level of precision. To mine more detailed information from those bars we look at intrabars , i.e., bars from a smaller timeframe (we call it the intrabar timeframe ) that are contained in one chart bar. If your chart Is running at 1D on a 24x7 market for example, most 1D chart bars will contain 24 underlying 1H bars in their dilation. On historical bars, this indicator looks at those intrabars to amass volumeβ delta information. If the intrabar is up, its volumeβ goes in the Buy bin, and inversely for the Sell bin. When price does not move on an intrabar, the polarity of the last known movement is used to determine in which bin its volumeβ goes.
In realtime, we have access to price and volumeβ change for each update of the chart. Because a 1D chart bar can be updated tens of thousands of times during the day, volumeβ delta calculations on those updates is much more precise. This precision, however, comes at a price:
ββ The script must be running on the chart for it to keep calculating in realtime.
ββ If you refresh your chart you will lose all accumulated realtime calculations on elapsed realtime bars, and the realtime bar.
ββElapsed realtime bars will recalculate as historical bars, i.e., using intrabar inspection, and the realtime bar's calculations will reset.
ββWhen the script recalculates elapsed realtime bars as historical bars, the values on those bars will change, which means the script repaints in those conditions.
ββ When the indicator first calculates on a chart containing an incomplete realtime bar, it will count ALL the existing volumeβ on the bar as Buy or Sell volumeβ,
ββdepending on the polarity of the bar at that point. This will skew calculations for that first bar. Scripts have no access to the history of a realtime bar's previous updates,
ββand intrabar inspection cannot be used on realtime bars, so this is the only to go about this.
ββ Even if alerts only trigger upon confirmation of their conditions after the realtime bar closes, they are repainting alerts
ββbecause they would perhaps not have calculated the same way using intrabar inspection.
ββ On markets like stocks that often have different EODβ and intraday feeds and volumeβ information,
ββthe volume's scale may not be the same for the realtime bar if your chart is at 1D, for example,
ββand the indicator is using an intraday timeframe to calculate on historical bars.
ββ Any chart timeframe can be used in realtime mode, but plots that include moving averages in their calculations may require many elapsed realtime bars before they can calculate.
ββYou might prefer drastically reducing the periods of the moving averages, or using the volumeβ columns mode, which displays instant values, instead of the line.
Volume Delta Balances
This indicator uses a variety of methods to evaluate five volumeβ delta balances and derive other values from those balances. The five balances are:
1 β On Bar Balance : This is the only balance using instant values; it is simply the subtraction of the Sell volumeβ from the Buy volumeβ on the bar.
2 β Average Balance : Calculates a distinct EMA for both the Buy and Sell volumes, and subtracts the Sell EMA from the Buy EMA.
3 β Momentum Balance : Starts by calculating, separately for both Buy and Sell volumes, the difference between the same EMAs used in "Average Balance" and
ββan SMA of double the period used for the "Average Balance" EMAs. The difference for the Sell side is subtracted from the difference for the Buy side,
ββand an RSI of that value is calculated and brought over the β50/+50 scale.
4 β Relative Balance : The reference values used in the calculation are the Buy and Sell EMAs used in the "Average Balance".
ββFrom those, we calculate two intermediate values using how much the instant Buy and Sell volumes on the bar exceed their respective EMAβββbut with a twist.
ββIf the bar's Buy volumeβ does not exceed the EMA of Buy volumeβ, a zero value is used. The same goes for the Sell volumeβ with the EMA of Sell volumeβ.
ββOnce we have our two intermediate values for the Buy and Sell volumes exceeding their respective MA, we subtract them. The final "Relative Balance" value is an ALMA of that subtraction.
ββThe rationale behind using zero values when the bar's Buy/Sell volumeβ does not exceed its EMA is to only take into account the more significant volumeβ.
ββIf both instant volumeβ values exceed their MA, then the difference between the two is the signal's value.
ββThe signal is called "relative" because the intermediate values are the difference between the instant Buy/Sell volumes and their respective MA.
ββThis balance flatlines when the bar's Buy/Sell volumes do not exceed their EMAs, which makes it useful to spot areas where trader interest dwindles, such as consolidations.
ββThe smaller the period of the final value's ALMA, the more easily you will see the balance flatline. These flat zones should be considered no-trade zones.
5 β Percent Balance : This balance is the ALMA of the ratio of the "On Bar Balance" value, i.e., the volumeβ delta balance on the bar (which can be positive or negative),
ββover the total volume for that bar.
From the balances and marker conditions, two more values are calculated:
1 β Marker Bias : It sums the up/down (+1/β1) occurrences of the markers 1 to 4 over a period you define, so it ranges from β4 to +4, times the period.
ββIts calculation will depend on the modes used to calculate markers 3 and 4.
2 β Combined Balances : This is the sum of the bull/bear (+1/β1) states of each of the five balances, so it ranges from β5 to +5.
ββ FEATURES
The indicator has two main modes of operation: Columns and Line .
Columns
β’ In Columns mode you can display stacked Buy/Sell volumeβ columns.
β’ The buy section always appears above the centerline, the sell section below.
β’ The top and bottom sections can be colored independently using eight different methods.
β’ The EMAs of the Buy/Sell values can be displayed (these are the same EMAs used to calculate the "Average Balance").
Line
β’ Displays one of seven signals: the five balances or one of two complementary values, i.e., the "Marker Bias" or the "Combined Balances".
β’ You can color the line and its fill using independent calculation modes to pack more information in the display.
βYou can thus appraise the state of 3 different values using the line itself, its color and the color of its fill.
β’ A "Divergence Levels" feature will use the line to automatically draw expanding levels on divergence events.
Default settings
Using the indicator's default settings, this is the information displayed:
β’ The line is calculated on the "Average Balance".
β’ The line's color is determined by the bull/bear state of the "Percent Balance".
β’ The line's fill gradient is determined by the advances/declines of the "Momentum Balance".
β’ The orange divergence dots are calculated using discrepancies between the polarity of the "On Bar Balance" and the chart's bar.
β’ The divergence levels are determined using the line's level when a divergence occurs.
β’ The background's fill gradient is calculated on advances/declines of the "Marker Bias".
β’ The chart bars are colored using advances/declines of the "Relative Balance". Divergences are shown in orange.
β’ The intrabar timeframe is automatically determined from the chart's timeframe so that a minimum of 50 intrabars are used to calculate volumeβ delta on historical bars.
Alerts
The configuration of the marker conditions explained further is what determines the conditions that will trigger alerts created from this script. Note that simply selecting the display of markers does not create alerts. To create an alert on this script, you must use ALT-A from the chart. You can create multiple alerts triggering on different conditions from this same script; simply configure the markers so they define the trigger conditions for each alert before creating the alert. The configuration of the script's inputs is saved with the alert, so from then on you can change them without affecting the alert. Alert messages will mention the marker(s) that triggered the specific alert event. Keep in mind, when creating alerts on small chart timeframes, that discrepancies between alert triggers and markers displayed on your chart are to be expected. This is because the alert and your chart are running two distinct instances of the indicator on different servers and different feeds. Also keep in mind that while alerts only trigger on confirmed conditions, they are calculated using realtime calculation mode, which entails that if you refresh your chart and elapsed realtime bars recalculate as historical bars using intrabar inspection, markers will not appear in the same places they appeared in realtime. So it's important to understand that even though the alert conditions are confirmed when they trigger, these alerts will repaint.
Let's go through the sections of the script's inputs.
Columns
The size of the Buy/Sell columns always represents their respective importance on the bar, but the coloring mode for tops and bottoms is independent. The default setup uses a standard coloring mode where the Buy/Sell columns are always in the bull/bear color with a higher intensity for the winning side. Seven other coloring modes allow you to pack more information in the columns. When choosing to color the top columns using a bull/bear gradient on "Average Balance", for example, you will have bull/bear colored tops. In order for the color of the bottom columns to continue to show the instant bar balance, you can then choose the "On Bar Balance β Dual Solid Colors" coloring mode to make those bars the color of the winning side for that bar. You can display the averages of the Buy and Sell columns. If you do, its coloring is controlled through the "Line" and "Line fill" sections below.
Line and Line fill
You can select the calculation mode and the thickness of the line, and independent calculations to determine the line's color and fill.
Zero Line
The zero line can display dots when all five balances are bull/bear.
Divergences
You first select the detection mode. Divergences occur whenever the up/down direction of the signal does not match the up/down polarity of the bar. Divergences are used in three components of the indicator's visuals: the orange dot, colored chart bars, and to calculate the divergence levels on the line. The divergence levels are dynamic levels that automatically build from the line's values on divergence events. On consecutive divergences, the levels will expand, creating a channel. This implementation of the divergence levels corresponds to my view that divergences indicate anomalies, hesitations, points of uncertainty if you will. It precludes any attempt to identify a directional bias to divergences. Accordingly, the levels merely take note of divergence events and mark those points in time with levels. Traders then have a reference point from which they can evaluate further movement. The bull/bear/neutral colors used to plot the levels are also congruent with this view in that they are determined by the line's position relative to the levels, which is how I think divergences can be put to the most effective use. One of the coloring modes for the line's fill uses advances/declines in the line after divergence events.
Background
The background can show a bull/bear gradient on six different calculations. As with other gradients, you can adjust its brightness to make its importance proportional to how you use it in your analysis.
Chart bars
Chart bars can be colored using seven different methods. You have the option of emptying the body of bars where volumeβ does not increase, as does my TLD indicator, and you can choose whether you want to show divergences.
Intrabar Timeframe
This is the intrabar timeframe that will be used to calculate volumeβ delta using intrabar inspection on historical bars. You can choose between four modes. The three "Auto-steps" modes calculate, from the chart's timeframe, the intrabar timeframe where the said number of intrabars will make up the dilation of chart bars. Adjustments are made for non-24x7 markets. "Fixed" mode allows you to select the intrabar timeframe you want. Checking the "Show TF" box will display in the lower-right corner the intrabar timeframe used at any given moment. The proper selection of the intrabar timeframe is important. It must achieve maximal granularity to produce precise results while not unduly slowing down calculations, or worse, causing runtime errors. Note that historical depth will vary with the intrabar timeframe. The smaller the timeframe, the shallower historical plots you will be.
Markers
Markers appear when the required condition has been confirmed on a closed bar. The configuration of the markers when you create an alert is what determines when the alert will trigger. Five markers are available:
β’ Balances Agreement : All five balances are either bullishβ or bearishβ.
β’ Double Bumps : A double bump is two consecutive up/down bars with +/β volumeββ delta, and rising Buy/Sell volumeβ above its average.
β’ Divergence confirmations : A divergence is confirmed up/down when the chosen balance is up/down on the previous bar when that bar was down/up, and this bar is up/down.
β’ Balance Shifts : These are bull/bear transitions of the selected signal.
β’ Marker Bias Shifts : Marker bias shifts occur when it crosses into bull/bear territory.
Periods
Allows control over the periods of the different moving averages used to calculate the balances.
Volumeβ Discrepancies
Stock exchanges do not report the same volumeβ for intraday and daily (or higher) resolutions. Other variations in how volumeβ information is reported can also occur in other markets, namely Forex, where volumeβ irregularities can even occur between different intraday timeframes. This will cause discrepancies between the total volumeβ on the bar at the chart's timeframe, and the total volumeββ calculated by adding the volumeββ of the intrabars in that bar's dilation. This does not necessarily invalidate the volumeββ delta information calculated from intrabars, but it tells us that we are using partial volumeβ data. A mechanism to detect chart vs intrabar timeframe volumeββ discrepancies is provided. It allows you to define a threshold percentage above which the background will indicate a difference has been detected.
Other Settings
You can control here the display of the gray dot reminder on realtime bars, and the display of error messages if you are using a chart timeframe that is not greater than the fixed intrabar timeframe, when you use that mode. Disabling the message can be useful if you only use realtime mode at chart timeframes that do not support intrabar inspection.
ββ RAMBLINGS
On Volumeβ Delta
Volumeβ is arguably the best complement to interpret price action, and I consider volumeβ delta to be the most effective way of processing volumeβ information. In periods of low-volatility price consolidations, volumeβ will typically also be lower than normal, but slight imbalances in the trend of the buy/sell volumeβ balance can sometimes help put early odds on the direction of the break from consolidation. Additionally, the progression of the volumeβ imbalance can help determine the proximity of the breakout. I also find volumeβ delta and the number of divergences very useful to evaluate the strength of trends. In trends, I am looking for "slow and steady", i.e., relatively low volatilityβ and pauses where price action doesn't look like world affairs are being reassessed. In my personal mythology, this type of trend is often more resilient than high-volatility breakouts, especially when volumeβ balance confirms the general agreement of traders signaled by the low-volatility usually accompanying this type of trend. The volumeβ action on pauses will often help me decide between aggressively taking profits, tightening a stop or going for a longer-term movement. As for reversals, they generally occur in high-volatility areas where entering trades is more expensive and riskier. While the identification of counter-trend reversals fascinates many traders to no end, they represent poor opportunities in my view. Volumeβ imbalances often precede reversals, but I prefer to use volumeβ delta information to identify the areas following reversals where I can confirm them and make relatively low-cost entries with better odds.
On "Buy/Sell" Volume
Buying or selling volumeβ are misnomers, as every unit of volumeβ transacted is both bought and sold by two different traders. While this does not keep me from using the terms, there is no such thing as βbuy onlyβ or βsell onlyβ volumeβ. Trader lingo is riddled with peculiarities.
Divergences
The divergence detection method used here relies on a difference between the direction of a signal and the polarity (up/down) of a chart bar. When using the default "On Bar Balance" to detect divergences, however, only the bar's volumeβ delta is used. You may wonder how there can be divergences between buying/selling volumeβ information and price movement on one bar. This will sometimes be due to the calculation's shortcomings, but divergences may also occur in instances where because of order book structure, it takes less volumeβ to increase the price of an asset than it takes to decrease it. As usual, divergences are points of interest because they reveal imbalances, which may or may not become turning points. To your pattern-hungry brain, the divergences displayed by this indicator willβββas they do on other indicatorsβββappear to often indicate turnarounds. My opinion is that reality is generally quite sobering and I have no reliable information that would tend to prove otherwise. Exercise caution when using them. Consequently, I do not share the overwhelming enthusiasm of traders in identifying bullishβ/bearishβ divergences. For me, the best course of action when a divergence occurs is to wait and see what happens from there. That is the rationale underlying how my divergence levels work; they take note of a signal's level when a divergence occurs, and it's the signal's behavior from that point on that determines if the post-divergence action is bullishβ/bearishβ.
Superfluity
In "The Bed of Procrustes", Nassim Nicholas Taleb writes: To bankrupt a fool, give him information . This indicator can display lots of information. While learning to use a new indicator inevitably requires an adaptation period where we put it through its paces and try out all its options, once you have become used to it and decide to adopt it, rigorously eliminate the components you don't use and configure the remaining ones so their visual prominence reflects their relative importance in your analysis. I tried to provide flexible options for traders to control this indicator's visuals for that exact reasonβββnot for window dressing.
ββ LIMITATIONS
β’ This script uses a special characteristic of the `security()` function allowing the inspection of intrabarsβββwhich is not officially supported by TradingView.
βIt has the advantage of permitting a more robust calculation of volumeβ delta than other methods on historical bars, but also has its limits.
β’ Intrabar inspection only works on some chart timeframes: 3, 5, 10, 15 and 30 minutes, 1, 2, 3, 4, 6, and 12 hours, 1 day, 1 week and 1 month.
βThe scriptβs code can be modified to run on other resolutions.
β’ When the difference between the chartβs timeframe and the intrabar timeframe is too great, runtime errors will occur. The Auto-Steps selection mechanisms should avoid this.
β’ All volumeβ is not created equally. Its source, components, quality and reliability will vary considerably with sectors and instruments.
βThe higher the quality, the more reliably volumeβ delta information can be used to guide your decisions.
βYou should make it your responsibility to understand the volumeβ information provided in the data feeds you use. It will help you make the most of volumeβ delta.
ββ NOTES
For traders
β’ The Data Window shows key values for the indicator.
β’ While this indicator displays some of the same information calculated in my DeltaβVolumeβColumns ,
βI have elected to make it a separate publication so that traders continue to have a simpler alternative available to them. Both code bases will continue to evolve separately.
β’ All gradients used in this indicator determine their brightness intensities using advances/declines in the signalβnot their relative position in a pre-determined scale.
β’ Volumeβ delta being relative, by nature, it is particularly well-suited to Forex markets, as it filters out quite elegantly the cyclical volumeβ data characterizing the sector.
If you are interested in volumeβ delta, consider having a look at my other "Delta Volume" indicators:
β’ DeltaβVolumeβRealtimeβAction displays realtime volumeβ delta and tick information on the chart.
β’ DeltaβVolumeβCandles builds volumeββ delta candles on the chart.
β’ DeltaβVolumeβColumns is a simpler version of this indicator.
For coders
β’ I use the `f_c_gradientRelativePro()` from the PineCoders Color Gradient Framework to build my gradients.
βThis function has the advantage of allowing begin/end colors for both the bull and bear colors. It also allows us to define the number of steps allowed for each gradient.
βI use this to modulate the gradients so they perform optimally on the combination of the signal used to calculate advances/declines,
βbut also the nature of the visual component the gradient applies to. I use fewer steps for choppy signals and when the gradient is used on discrete visual components
βsuch as volumeβ columns or chart bars.
β’ I use the PineCoders Coding Conventions for Pine to write my scripts.
β’ I used functions modified from the PineCoders MTF Selection Framework for the selection of timeframes.
ββ THANKS TO:
β The devs from TradingView's Pine and other teams, and the PineCoders who collaborate with them. They are doing amazing work,
βand much of what this indicator does could not be done without their recent improvements to Pine.
β A guy called Kuan who commented on a Backtest Rookies presentation of their Volume Profile indicator using a `for` loop.
βThis indicator started from the intrabar inspection technique illustrated in Kuan's snippet.
β theheirophant , my partner in the exploration of the sometimes weird abysses of `security()`βs behavior at intrabar timeframes.
β midtownsk8rguy , my brilliant companion in mining the depths of Pine graphics.
.srb suiteThe essential suite Indicator.
that are well integrated to ensure visibility of essential items for trading.
it is very cumbersome to put symbol in the Tradingview chart and combine essential individual indicators one by one.
Moreover even with such a combination, the chart is messy and visibility is not good.
This is because each indicator is not designed with the others in mind.
This suite was developed as a composite-solution to that situation, and will make you happy.
designed to work in the same pane with open-source indicator by default.
Recommended visual order ; Back = .srb suite, Front = .srb suite vol & info
individually turn on/off only what you need on the screen.
BTC-agg. Volume
4 BTC-spot & 4 BTC-PERP volume aggregated.
It might helps you don't miss out on important volume flows.
Weighted to spot trading volume when using PERP+spot volume .
If enabled, BTC-agg.Vol automatically applied when selecting BTC-pair.
--> This is used in calculations involving volumes, such as VWAP.
Moving Average
1 x JMA trend ribbon ; Accurately follow short-term trend changes.
3 x EMA ribbon ; zone , not the line.
MA extension line ; It provide high visibility to recognize the direction of the MA.
SPECIAL TOOLS
VWAP with Standard Deviation Bands
VWAP ruler
BB regular (Dev. 2.0, 2.5)
BB Extented (Dev. 2.5, 3.0, 3.5)
Fixed Range Volume Profile ; steamlined one, performace tuned & update.
SPECIAL TOOLS - Auto Fibonacci Retracement - New GUI
'built-in auto FBR ' has been re-born
It shows - retracement Max top/ min bottom ; for higher visibility
It shows - current retracement position ; for higher visibility
The display of the Fib position that exceeds the regular range is auto-determined according to the price.
tradingview | chart setting > Appearance > Top margin 0%, Bottom margin 0% for optimized screen usage
tradingview | chart setting > Appearance > Right margin 57
.srb suite vol & info --> Visual Order > Bring to Front
.srb suite vol & info --> Pin to scale > No scale (Full-screen)
Visual order ; Back = .srb suite, Front = .srb suite vol & info
1. Fib.Retracement core is from tradingview built-in FBR ---> upgrade new-type GUI, and performance tuned.
2. Fixed-range volume-profile core is from the open-source one ---> some update & perf.tuned.
---------------------------------------------------------------------------------------------------------------------------------------
if you have any questions freely contact to me by message on tradingview.
but please understand that responses may be quite late.
Special thanks to all of contributors of community.
The script may be freely distributed under the MIT license.
Market Profile Fixed ViewSome instruments does not provide any volume information, therefore, as a fixed volume profile user, I needed a fixed market profile indicator to use the same principles, regardless of whether the volumes are available or not.
This script draws a market profile histogram corresponding to price variations within a specific duration, you only need to specify Start and End date/time values to see the histogram on your chart.
Details
Two lines corresponding to highest/lowest prices are displayed around the histogram
The redline corresponds to the POC (point of control)
Options
Start calculation
End calculation
Bars number (histogram resolution, currently locked to a max value of 50 bars)
Display side/Width (allows to modify size of bars, to the left or to the right)
Bars/Borders/POC Color customization
Notes
This script will probably be updated (to add VAH/VAL zones, and maybe other options). However, some common market profile attributes have not been implemented yet since I don't really use them)
VPoC per barThis study prints the current bar VPoC as an horizontal line.
It's aimed originally at BTCUSDT pair and 15m timeframe.
HOW IT WORKS
Zoom In mode: This is the default mode.
The study zooms in into the latest 15 1-minute bar candles in order to calculate the 15 minute candle VPoC.
Zoom Out mode: The VPoC from the last n bars from the current timeframe that match desired timeframe is shown on each bar.
In either case you are recommended to click on the '...' button associated to this study
and select 'Visual Order. Bring to Front.' so that it's properly shown in your chart.
HOW IT WORKS - Zoom In mode
Make sure that '(VP) Zoom into the VP timeframe' setting is set to true.
Choose the zoomed in timeframe where to calculate VPoC from thanks to the '(VP) Zoomed timeframe {1 minute}' setting.
Change '(VP) Zoomed in timeframe bars per current timeframe bar {15}' to its appropiated value. You just need to divide the current timeframe minutes per the zoomed in timeframe minutes per bar. E.g. If you are in 60 minute timeframe and you want to zoom in into 5 minute timeframe: 60 / 5 = 12 . You will write 12 here.
HOW IT WORKS - Zoom Out mode
Make sure that '(VP) Zoom into the VP timeframe' setting is set to false.
If you are using the Zoom out mode you might want to set '(VP) Print VPoC price as discrete lines {True}' to false.
Either choose the zoommed out timeframe where to calculate VPoC from thanks to the '(VP) Zoomed timeframe {1 minute}' setting or turn on the '(VP) Use number of bars (not VP timeframe)' setting in order to use '(VP) Number of bars {100}' as a custom number of bars.
WARNING - Zoom In mode last bar
The way that PineScript handles security function in last bar might result on the last bar not being accurate enough.
SETTINGS
__ SETTINGS - Volume Profile
(VP) Zoomed timeframe {1 minute}: Timeframe in which to zoom in or zoom out to calculate an accurate VPoC for the current timeframe.
(VP) Zoomed in timeframe bars per current timeframe bar {15}: Check 'HOW IT WORKS - Zoom In mode' above. Note : It is only used in 'Zoom in' mode.
(VP) Number of bars {100}: If 'Use number of bars (not VP timeframe)' is turned on this setting is used to calculate session VPoC. Note : It is only used in 'Zoom out' mode.
(VP) Price levels {24}: Price levels for calculating VPoC.
__ SETTINGS - MAIN TURN ON/OFF OPTIONS
(VP) Print VPoC price {True}: Show VPoC price
(VP) Zoom into the VP timeframe: When set to true the VPoC is calculated by zooming into the lower timeframe. When set to false a higher timeframe (or number of bars) is used.
(VP) Realtime Zoom in (Beta): Enable real time zoom for the last bar. It's beta because it would only work with zoomed in timeframe under 60 minutes. And when ratio between zoomout and zoomin is less than 60. Note : It is only used in 'Zoom in' mode.
(VP) Use number of bars (not VP timeframe): Uses 'Number of bars {100}' setting instead of 'Volume Profile timeframe' setting for calculating session VPoC. Note : It is only used in 'Zoom out' mode.
(VP) Print VPoC price as discrete lines {True}: When set to true the VPoC is shown as an small line in the center of each bar. When set to the false the VPoC line is printed as a normal line.
__ SETTINGS - EXTRA
(VP) VPoC color: Change the VPoC color
(VP) VPoC line width {1}: Change VPoC line width (in pixels).
(VP) Use number of bars (not VP timeframe): Uses 'Number of bars {100}' setting instead of 'Volume Profile timeframe' setting for calculating session VPoC. Note : It is only used in 'Zoom out' mode.
(VP) Print VPoC price as discrete lines {True}: When set to true the VPoC is shown as an small line in the center of each bar. When set to the false the VPoC line is printed as a normal line.
CREDITS
I have reused and adapted some code from
"Poor man's volume profile" study
which it's from TradingView IldarAkhmetgaleev user.
Bar Balance [LucF]Bar Balance extracts the number of up, down and neutral intrabars contained in each chart bar, revealing information on the strength of price movement. It can display stacked columns representing raw up/down/neutral intrabar counts, or an up/down balance line which can be calculated and visualized in many different ways.
WARNING: This is an analysis tool that works on historical bars only. It does not show any realtime information, and thus cannot be used to issue alerts or for automated trading. When realtime bars elapse, the indicator will require a browser refresh, a change to its Inputs or to the chart's timeframe/symbol to recalculate and display information on those elapsed bars. Once a trader understands this, the indicator can be used advantageously to make discretionary trading decisions.
Traders used to work with myβ DeltaβVolumeβColumnsβPro βwill feel right at home in this indicator's Inputs . It has lots of options, allowing it to be used in many different ways. If you value the bar balance information this indicator mines, I hope you will find the time required to master the use of Bar Balance well worth the investment.
ββ OVERVIEW
The indicator has two modes: Columns and Line .
Columns
β’ In Columns mode you can display stacked Up/Down/Neutral columns.
β’ The "Up" section represents the count of intrabars where `close > open`, "Down" where `close < open` and "Neutral" where `close = open`.
β’ The Up section always appears above the centerline, the Down section below. The Neutral section overlaps the centerline, split halfway above and below it.
βThe Up and Down sections start where the Neutral section ends, when there is one.
β’ The Up and Down sections can be colored independently using 7 different methods.
β’ The signal line plotted in Line mode can also be displayed in Columns mode.
Line
β’ Displays a single balance line using a zero centerline.
β’ A variable number of independent methods can be used to calculate the line (6), determine its color (5), and color the fill (5).
βYou can thus evaluate the state of 3 different components with this single line.
β’ A "Divergence Levels" feature will use the line to automatically draw expanding levels on divergence events.
Features available in both modes
β’ The color of all components can be selected from 15 base colors, with 16 gradient levels used for each base color in the indicator's gradients.
β’ A zero line can show a 6-state aggregate value of the three main volume balance modes.
β’ The background can be colored using any of 5 different methods.
β’ Chart bars can be colored using 5 different methods.
β’ Divergence and large neutral count ratio events can be shown in either Columns or Line mode, calculated in one of 4 different methods.
β’ Markers on 6 different conditions can be displayed.
ββ CONCEPTS
Intrabar inspection
Intrabar inspection means the indicator looks at lower timeframe bars ( intrabars ) making up a given chart bar to gather its information. If your chart is on a 1-hour timeframe and the intrabar resolution determined by the indicator is 5 minutes, then 12 intrabars will be analyzed for each chart bar and the count of up/down/neutral intrabars among those will be tallied.
Bar Balances and calculation methods
The indicator uses a variety of methods to evaluate bar balance and to derive other calculations from them:
1. Balance on Bar : Uses the relative importance of instant Up and Down counts on the bar.
2. Balance Averages : Uses the difference between the EMAs of Up and Down counts.
3. Balance Momentum : Starts by calculating, separately for both Up and Down counts, the difference between the same EMAs used in Balance Averages and an SMA of double the period used for the EMAs. These differences are then aggregated and finally, a bounded momentum of that aggregate is calculated using RSI.
4. Markers Bias : It sums the bull/bear occurrences of the four previous markers over a user-defined period (the default is 14).
5. Combined Balances : This is the aggregate of the instant bull/bear bias of the three main bar balances.
6. Dual Up/Down Averages : This is a display mode showing the EMA calculated for each of the Up and Down counts.
Interpretation of neutral intrabars
What do neutral intrabars mean? When price does not change during a bar, it can be because there is simply no interest in the market, or because of a perfect balance between buyers and sellers. The latter being more improbable, Bar Balance assumes that neutral bars reveal a lack of interest, which entails uncertainty. That is the reason why the option is provided to interpret ratios of neutral intrabars greater than 50% as divergences. It is also the rationale behind the option to dampen signal lines on the inverse ratio of neutral intrabars, so that zero intrabars do not affect the signal, and progressively larger proportions of neutral intrabars will reduce the signal's amplitude, as the balance calcs using the up/down counts lose significance. The impact of the dampening will vary with markets. Weaker markets such as cryptos will often contain greater numbers of neutral intrabars, so dampening the Line in that sector will have a greater impact than in more liquid markets.
ββ FEATURES
1 β Columns
β’ While the size of the Up/Down columns always represents their respective importance on the bar, their coloring mode is independent. The default setup uses a standard coloring mode where the Up/Down columns over/under the zero line are always in the bull/bear color with a higher intensity for the winning side. Six other coloring modes allow you to pack more information in the columns. When choosing to color the top columns using a bull/bear gradient on Balance Averages, for example, you will end up with bull/bear colored tops. In order for the color of the bottom columns to continue to show the instant bar balance, you can then choose the "Up/Down Ratio on Bar β Dual Solid Colors" coloring mode to make those bars the color of the winning side for that bar.
β’ Line mode shows only the line, but Columns mode allows displaying the line along with it. If the scale of the line is different than that of the scale of the columns, the line will often appear flat. Traders may find even a flat line useful as its bull/bear colors will be easily distinguishable.
2 β Line
β’ The default setup for Line mode uses a calculation on "Balance Momentum", with a fill on the longer-term "Balance Averages" and a line color based on the "Markers Bias". With the background set on "Line vs Divergence Levels" and the zero line on the hard-coded "Combined Bar Balances", you have access to five distinct sources of information at a glance, to which you can add divergences, divergences levels and chart bar coloring. This provides powerful potential in displaying bar balance information.
β’ When no columns are displayed, Line mode can show the full scale of whichever line you choose to calculate because the columns' scale no longer interferes with the line's scale.
β’ Note that when "Balance on Bar" is selected, the Neutral count is also displayed as a ratio of the balance line. This is the only instance where the Neutral count is displayed in Line mode.
β’ The "Dual Up/Down Averages" is an exception as it displays two lines: one average for the Up counts and another for the Down counts. This mode will be most useful when Columns are also displayed, as it provides a reference for the top and bottom columns.
3 β Zero Line
The zero line can be colored using two methods, both based on the Combined Balances, i.e., the aggregate of the instant bull/bear bias of the three main bar balances.
β’ In "Six-state Dual Color Gradient" mode, a dot appears on every bar. Its color reflects the bull/bear state of the Combined Balances, and the dot's brightness reflects the tally of balance biases.
β’ In "Dual Solid Colors (All Bull/All Bear Only)" a dot only appears when all three balances are either bullish or bearish. The resulting pattern is identical to that of Marker 1.
4 β Divergences
β’ Divergences are displayed as a small circle at the top of the scale. Four different types of divergence events can be detected. Divergences occur whenever the bull/bear bias of the method used diverges with the bar's price direction.
β’ An option allows you to include in divergence events instances where the count of neutral intrabars exceeds 50% of the total intrabar count.
β’ The divergence levels are dynamic levels that automatically build from the line's values on divergence events. On consecutive divergences, the levels will expand, creating a channel. This implementation of the divergence levels corresponds to my view that divergences indicate anomalies, hesitations, points of uncertainty if you will. It excludes any association of a pre-determined bullish/bearish bias to divergences. Accordingly, the levels merely take note of divergence events and mark those points in time with levels. Traders then have a reference point from which they can evaluate further movement. The bull/bear/neutral colors used to plot the levels are also congruent with this view in that they are determined by price's position relative to the levels, which is how I think divergences can be put to the most effective use.
5 β Background
β’ The background can show a bull/bear gradient on four different calculations. You can adjust its brightness to make its visual importance proportional to how you use it in your analysis.
6 β Chart bars
β’ Chart bars can be colored using five different methods.
β’ You have the option of emptying the body of bars where volume does not increase, as does my TLD indicator, the idea behind this being that movement on bars where volume does not increase is less relevant.
7 β Intrabar Resolution
You can choose between three modes. Two of them are automatic and one is manual:
ββa) Fast, Longer history, Auto-Steps (~12 intrabars) : Optimized for speed and deeper history. Uses an average minimum of 12 intrabars.
ββb) More Precise, Shorter History Auto-Steps (~24 intrabars) : Uses finer intrabar resolution. It is slower and provides less history. Uses an average minimum of 24 intrabars.
ββc) Fixed : Uses the fixed resolution of your choice.
Auto-Steps calculations vary for 24/7 and conventional markets in order to achieve the proper target of minimum intrabars.
You can choose to view the intrabar resolution currently used to calculate delta volume. It is the default.
The proper selection of the intrabar resolution is important. It must achieve maximal granularity to produce precise results while not unduly slowing down calculations, or worse, causing runtime errors.
8 β Markers
Six markers are available:
1. Combined Balances Agreement : All three Bar Balances are either bullish or bearish.
2. Up or Down % Agrees With Bar : An up marker will appear when the percentage of up intrabars in an up chart bar is greater than the specified percentage. Conditions mirror to down bars.
3. Divergence confirmations By Price : One of the four types of balance calculations can be used to detect divergences with price. Confirmations occur when the bar following the divergence confirms the balance bias. Note that the divergence events used here do not include neutral intrabar events.
4. Balance Transitions : Bull/bear transitions of the selected balance.
5. Markers Bias Transitions : Bull/bear transitions of the Markers Bias.
6. Divergence Confirmations By Line : Marks points where the line first breaches a divergence level.
Markers appear when the condition is detected, without delay. Since nothing is plotted in realtime, markers do not appear on the realtime bar.
9 β Settings
β’ Two modes can be selected to dampen the line on the ratio of neutral intrabars.
β’ A distinct weight can be attributed to the count of the latter half of intrabars, on the assumption that later intrabars may be more important in determining the outcome of chart bars.
β’ Allows control over the periods of the different moving averages used in calculations.
β’ The default periods used for the various calculations define the following hierarchy from slow to fast:
ββBalance Averages: 50,
ββBalance Momentum: 20,
ββDual Up/Down Averages: 20,
ββMarker Bias: 10.
ββ LIMITATIONS
β’ This script uses a special characteristic of the `security()` function allowing the inspection of intrabarsβwhich is not officially supported by TradingView.
β’ The method used does not work on the realtime barβonly on historical bars.
β’ The indicator only works on some chart resolutions: 3, 5, 10, 15 and 30 minutes, 1, 2, 4, 6, and 12 hours, 1 day, 1 week and 1 month. The scriptβs code can be modified to run on other resolutions, but chart resolutions must be divisible by the lower resolution used for intrabars and the stepping mechanism could require adaptation.
β’ When using the "Line vs Divergence Levels β Dual Color Gradient" color mode to fill the line, background or chart bars, keep in mind that a line calculation mode must be defined for it to work, as it determines gradients on the movement of the line relative to divergence levels. If the line is hidden, it will not work.
β’ When the difference between the chartβs resolution and the intrabar resolution is too great, runtime errors will occur. The Auto-Steps selection mechanisms should avoid this.
β’ Alerts do not work reliably when `security()` is used at intrabar resolutions. Accordingly, no alerts are configured in the indicator.
β’ The color model used in the indicator provides for fancy visuals that come at a price; when you change values in Inputs , it can take 20 seconds for the changes to materialize. Luckily, once your color setup is complete, the color model does not have a large performance impact, as in normal operation the `security()` calls will become the most important factor in determining response time. Also, once in a while a runtime error will occur when you change inputs. Just making another change will usually bring the indicator back up.
ββ RAMBLINGS
Is this thing useful?
I'll let you decide. Bar Balance acts somewhat like an X-Ray on bars. The intrabars it analyzes are no secret; one can simply change the chart's resolution to see the same intrabars the indicator uses. What the indicator brings to traders is the precise count of up/down/neutral intrabars and, more importantly, the calculations it derives from them to present the information in a way that can make it easier to use in trading decisions.
How reliable is Bar Balance information?
By the same token that an up bar does not guarantee that more up bars will follow, future price movements cannot be inferred from the mere count of up/down/neutral intrabars. Price movement during any chart bar for which, let's say, 12 intrabars are analyzed, could be due to only one of those intrabars. One can thus easily see how only relying on bar balance information could be very misleading. The rationale behind Bar Balance is that when the information mined for multiple chart bars is aggregated, it can provide insight into the history behind chart bars, and thus some bias as to the strength of movements. An up chart bar where 11/12 intrabars are also up is assumed to be stronger than the same up bar where only 2/12 intrabars are up. This logic is not bulletproof, and sometimes Bar Balance will stray. Also, keep in mind that balance lines do not represent price momentum as RSI would. Bar Balance calculations have no idea where price is. Their perspective, like that of any historian, is very limited, constrained that it is to the narrow universe of up/down/neutral intrabar counts. You will thus see instances where price is moving up while Balance Momentum, for example, is moving down. When Bar Balance performs as intended, this indicates that the rally is weakening, which does necessarily imply that price will reverse. Occasionally, price will merrily continue to advance on weakening strength.
Divergences
Most of the divergence detection methods used here rely on a difference between the bias of a calculation involving a multi-bar average and a given bar's price direction. When using "Bar Balance on Bar" however, only the bar's balance and price movement are used. This is the default mode.
As usual, divergences are points of interest because they reveal imbalances, which may or may not become turning points. I do not share the overwhelming enthusiasm traders have for the purported ability of bullish/bearish divergences to indicate imminent reversals.
Superfluity
In "The Bed of Procrustes", Nassim Nicholas Taleb writes: To bankrupt a fool, give him information . Bar Balance can display lots of information. While learning to use a new indicator inevitably requires an adaptation period where we put it through its paces and try out all its options, once you have become used to Bar Balance and decide to adopt it, rigorously eliminate the components you don't use and configure the remaining ones so their visual prominence reflects their relative importance in your analysis. I tried to provide flexible options for traders to control this indicator's visuals for that exact reasonβnot for window dressing.
ββ NOTES
For traders
β’ To avoid misleading traders who don't read script descriptions, the indicator shows nothing in the realtime bar.
β’ The Data Window shows key values for the indicator.
β’ All gradients used in this indicator determine their brightness intensities using advances/declines in the signalβnot their relative position in a fixed scale.
β’ Note that because of the way gradients are optimized internally, changing their brightness will sometimes require bringing down the value a few steps before you see an impact.
β’ Because this indicator does not use volume, it will work on all markets.
For coders
β’ For those interested in gradients, this script uses an advanced version of the Advance/Decline gradient function from the PineCoders Color Gradient (16 colors) Framework . It allows more precise control over the range, steps and min/max values of the gradients.
β’ I use the PineCoders Coding Conventions for Pine to write my scripts.
β’ I used functions modified from the PineCoders MTF Selection Framework for the selection of timeframes.
ββ THANKS TO:
β alexgrover who helped me think through the dampening method used to attenuate signal lines on high ratios of neutral intrabars.
β A guy called Kuan who commented on a Backtest Rookies presentation of their Volume Profile indicator . The technique I use to inspect intrabars is derived from Kuan's code.
β theheirophant , my partner in the exploration of the sometimes weird abysses of `security()`βs behavior at intrabar resolutions.
β midtownsk8rguy , my brilliant companion in mining the depths of Pine graphics. He is also the co-author of the PineCoders Color Gradient Frameworks .
PRINT_TYPELibrary "PRINT_TYPE"
Inputs
ββInputs objects
ββFields:
ββββ inbalance_percent (series int) : percentage coefficient to determine the Imbalance of price levels
ββββ stacked_input (series int) : minimum number of consecutive Imbalance levels required to draw extended lines
ββββ show_summary_footprint (series bool)
ββββ procent_volume_area (series int) : definition size Value area
ββββ new_imbalance_cond (series bool) : bool input for setup alert on new imbalance buy and sell
ββββ new_imbalance_line_cond (series bool) : bool input for setup alert on new imbalance line buy and sell
ββββ stop_past_imbalance_line_cond (series bool) : bool input for setup alert on stop past imbalance line buy and sell
Constants
ββConstants all Constants objects
ββFields:
ββββ imbalance_high_char (series string) : char for printing buy imbalance
ββββ imbalance_low_char (series string) : char for printing sell imbalance
ββββ color_title_sell (series color) : color for footprint sell
ββββ color_title_buy (series color) : color for footprint buy
ββββ color_line_sell (series color) : color for sell line
ββββ color_line_buy (series color) : color for buy line
ββββ color_title_none (series color) : color None
Calculation_data
ββCalculation_data data for calculating
ββFields:
ββββ detail_open (array) : array open from calculation timeframe
ββββ detail_high (array) : array high from calculation timeframe
ββββ detail_low (array) : array low from calculation timeframe
ββββ detail_close (array) : array close from calculation timeframe
ββββ detail_vol (array) : array volume from calculation timeframe
ββββ previos_detail_close (array) : array close from calculation timeframe
ββββ isBuyVolume (series bool) : attribute previosly bar buy or sell
Footprint_row
ββFootprint_row objects one footprint row
ββFields:
ββββ price (series float) : row price
ββββ buy_vol (series float) : buy volume
ββββ sell_vol (series float) : sell volume
ββββ imbalance_buy (series bool) : attribute buy inbalance
ββββ imbalance_sell (series bool) : attribute sell imbalance
ββββ buy_vol_box (series box) : for ptinting buy volume
ββββ sell_vol_box (series box) : for printing sell volume
ββββ buy_vp_box (series box) : for ptinting volume profile buy
ββββ sell_vp_box (series box) : for ptinting volume profile sell
ββββ row_line (series label) : for ptinting row price
ββββ empty (series bool) : = true attribute row with zero volume buy and zero volume sell
Imbalance_line_var_object
ββImbalance_line_var_object var objects printing and calculation imbalance line
ββFields:
ββββ cum_buy_line (array) : line array for saving all history buy imbalance line
ββββ cum_sell_line (array) : line array for saving all history sell imbalance line
Imbalance_line
ββImbalance_line objects printing and calculation imbalance line
ββFields:
ββββ buy_price_line (array) : float array for saving buy imbalance price level
ββββ sell_price_line (array) : float array for saving sell imbalance price level
ββββ var_imba_line (Imbalance_line_var_object) : var objects this type
Footprint_bar
ββFootprint_bar all objects one bar with footprint
ββFields:
ββββ foot_rows (array) : objects one row footprint
ββββ imba_line (Imbalance_line) : objects imbalance line
ββββ row_size (series float) : size rows
ββββ total_vol (series float) : total volume one footprint bar
ββββ foot_buy_vol (series float) : buy volume one footprint bar
ββββ foot_sell_vol (series float) : sell volume one footprint bar
ββββ foot_max_price_vol (map) : map with one value - price row with max volume buy + sell
ββββ calc_data (Calculation_data) : objects with detail data from calculation resolution
Support_objects
ββSupport_objects support object for footprint calculation
ββFields:
ββββ consts (Constants) : all consts objects
ββββ inp (Inputs) : all input objects
ββββ bar_index_show_condition (series bool) : calculation bool value for show all objects footprint
ββββ row_line_color (series color) : calculation value - color for row price
ββββ dop_info (series string)
ββββ show_table_cond (series bool)
footprint_typeLibrary "footprint_type"
Contains all types for calculating and rendering footprints
Inputs
ββInputs objects
ββFields:
ββββ inbalance_percent (series int) : percentage coefficient to determine the Imbalance of price levels
ββββ stacked_input (series int) : minimum number of consecutive Imbalance levels required to draw extended lines
ββββ show_summary_footprint (series bool) : bool input for show summary footprint
ββββ procent_volume_area (series int) : definition size Value area
ββββ show_vah (series bool) : bool input for show VAH
ββββ show_poc (series bool) : bool input for show POC
ββββ show_val (series bool) : bool input for show VAL
ββββ color_vah (series color) : color VAH line
ββββ color_poc (series color) : color POC line
ββββ color_val (series color) : color VAL line
ββββ show_volume_profile (series bool)
ββββ new_imbalance_cond (series bool) : bool input for setup alert on new imbalance buy and sell
ββββ new_imbalance_line_cond (series bool) : bool input for setup alert on new imbalance line buy and sell
ββββ stop_past_imbalance_line_cond (series bool) : bool input for setup alert on stop past imbalance line buy and sell
Constants
ββConstants all Constants objects
ββFields:
ββββ imbalance_high_char (series string) : char for printing buy imbalance
ββββ imbalance_low_char (series string) : char for printing sell imbalance
ββββ color_title_sell (series color) : color for footprint sell
ββββ color_title_buy (series color) : color for footprint buy
ββββ color_line_sell (series color) : color for sell line
ββββ color_line_buy (series color) : color for buy line
ββββ color_title_none (series color) : color None
Calculation_data
ββCalculation_data data for calculating
ββFields:
ββββ detail_open (array) : array open from calculation timeframe
ββββ detail_high (array) : array high from calculation timeframe
ββββ detail_low (array) : array low from calculation timeframe
ββββ detail_close (array) : array close from calculation timeframe
ββββ detail_vol (array) : array volume from calculation timeframe
ββββ previos_detail_close (array) : array close from calculation timeframe
ββββ isBuyVolume (series bool) : attribute previosly bar buy or sell
Footprint_row
ββFootprint_row objects one footprint row
ββFields:
ββββ price (series float) : row price
ββββ buy_vol (series float) : buy volume
ββββ sell_vol (series float) : sell volume
ββββ imbalance_buy (series bool) : attribute buy inbalance
ββββ imbalance_sell (series bool) : attribute sell imbalance
ββββ buy_vol_box (series box) : for ptinting buy volume
ββββ sell_vol_box (series box) : for printing sell volume
ββββ buy_vp_box (series box) : for ptinting volume profile buy
ββββ sell_vp_box (series box) : for ptinting volume profile sell
ββββ row_line (series label) : for ptinting row price
ββββ empty (series bool) : = true attribute row with zero volume buy and zero volume sell
Value_area
ββValue_area objects for calculating and printing Value area
ββFields:
ββββ vah_price (series float) : VAH price
ββββ poc_price (series float) : POC price
ββββ val_price (series float) : VAL price
ββββ vah_label (series label) : label for VAH
ββββ poc_label (series label) : label for POC
ββββ val_label (series label) : label for VAL
ββββ vah_line (series line) : line for VAH
ββββ poc_level (series line) : line for POC
ββββ val_line (series line) : line for VAL
Imbalance_line_var_object
ββImbalance_line_var_object var objects printing and calculation imbalance line
ββFields:
ββββ cum_buy_line (array) : line array for saving all history buy imbalance line
ββββ cum_sell_line (array) : line array for saving all history sell imbalance line
Imbalance_line
ββImbalance_line objects printing and calculation imbalance line
ββFields:
ββββ buy_price_line (array) : float array for saving buy imbalance price level
ββββ sell_price_line (array) : float array for saving sell imbalance price level
ββββ var_imba_line (Imbalance_line_var_object) : var objects this type
Footprint_info_var_object
ββFootprint_info_var_object var objects for info printing
ββFields:
ββββ cum_delta (series float) : var delta volume
ββββ cum_total (series float) : var total volume
ββββ cum_buy_vol (series float) : var buy volume
ββββ cum_sell_vol (series float) : var sell volume
ββββ cum_info (series table) : table for ptinting
Footprint_info
ββFootprint_info objects for info printing
ββFields:
ββββ var_info (Footprint_info_var_object) : var objects this type
ββββ total (series label) : total volume
ββββ delta (series label) : delta volume
ββββ summary_label (series label) : label for ptinting
Footprint_bar
ββFootprint_bar all objects one bar with footprint
ββFields:
ββββ foot_rows (array) : objects one row footprint
ββββ val_area (Value_area) : objects Value area
ββββ imba_line (Imbalance_line) : objects imbalance line
ββββ info (Footprint_info) : objects info - table,label and their variable
ββββ row_size (series float) : size rows
ββββ total_vol (series float) : total volume one footprint bar
ββββ foot_buy_vol (series float) : buy volume one footprint bar
ββββ foot_sell_vol (series float) : sell volume one footprint bar
ββββ foot_max_price_vol (map) : map with one value - price row with max volume buy + sell
ββββ calc_data (Calculation_data) : objects with detail data from calculation resolution
Support_objects
ββSupport_objects support object for footprint calculation
ββFields:
ββββ consts (Constants) : all consts objects
ββββ inp (Inputs) : all input objects
ββββ bar_index_show_condition (series bool) : calculation bool value for show all objects footprint
ββββ row_line_color (series color) : calculation value - color for row price
Tick Profile HeatmapThis is a market internal TICK heatmap with the intent of displaying areas of price associated to stronger reactions with NYSE TICK (by default).
This code is based off of a variation of a Volume Profile coded originally by colejustice who originally used code from LuxAlgo . The full-width volume bars that colejustice setup were replaced with full-width bars representative of TICK breaking +/- $500, the current cumulative value representing the "heat" is comprised of hlc3 by default but that can be changed. In a future update I may add additional logic here to capture highs and lows in the heatmap specifically, and perhaps additional colors.
As with other traditional profiling studies, this indicators purpose is to visualize correspondence to specific price levels, allowing rapid assessment where the most TICK activity is occurring, and where it hasn't been. This information may provide areas of support and resistance and regions where price may move quickly repeatedly.
All of the same input guidance that colejustice provided is the same for those pre-existing inputs:
Inputs are set up such that you can customize the lookback period, number of rows, and width of rows for most major timeframes individually. Timeframes between those available will use the next lower timeframe settings (e.g., 2m chart will use the 1m settings.)
Zero usage of volume is present in this indicator, only TICK data so please don't confuse it with volume studies.
Volume CompressorTurns volume into a more informative representation, ready to be further analyzed
...
Rationale
Volume
Back in the "before the quant" days I was a big fan of market & volume profile. Thing is J. Steidlmayer had lotta different ideas & works aside of profiling, it's just most of them ain't got to mainstream, one of them was "Hot / Cold volume" (yes, you can't really google it). From my interpretation, the idea was that in a given asset there is a usual constant volume that stays there no matter what, and if it ever changes it changes very slow and gradually; and there's another kind of, so to say, 'active' volume that actually influences price dynamics and very volatile by its nature. So I've met concept lately, and decided to quantify & model it one day when I'll have an idea how. That day was yesterday.
Compression
When we do music we always use different kinds of filters (low-pass, high pass, etc) for equalization and filtering itself. That stuff we use in finance as well. What we also always use in music are compressors, there dynamic processors that automatically adjust volume so it will be more consistent. Almost all the cool music you hear is compressed (both individual instruments (especially vocals) and the whole track afterwards), otherwise stuff will be too quite and too weak to flex on it, and also DJing it would be a nightmare. I am a big adept of loudness war. So I was like, how can I use compression in finance, when ima get an idea? That day was yesterday as well.
Volume structure
Being inspired by Steidlmayer's idea, I decided to distinguish volume this way:
1) Passive / static volume. The ~ volume that's always there no matter what (hedges, arbitrages, spread legs, portfolio parts etc etc), doesn't affect things;
2) Active / dynamic volume. The volume that flows from one asset to another, really matters and affects things;
3) Excess volume. The last portion of number 2 volume, that doesn't represent any powerful value to affect things.
Now it's clear that we can get rid of number 1 and number 3, the components that don't really matter, and concentrate on number 2 in order to improve information gain, both for ourselves and for the models we feed this data. How?
Model
I don't wanna explain it all in statistical / DSP way for once.
First of all, I think the population of volumes is log-normally distributed, so let's take logs of volumes, now we have a ~ normally distributed data. We take linearly weighted mean, add and subtract linearly weighted standard deviation from it, these would be our thresholds, the borders between different kinds of volumes explained before.
The upper threshold is for downward compression, that will not let volume pass it higher.
The lower threshold is for upward compression, all the volumes lower than this threshold will be brought up to the threshold's level.
Then we apply multipliers to the thresholds in order to adjust em and find the sweet spots. We do it the same way as in sound engineering when we don't aim for overcompression, we adjust the thresholds until they start to touch the signal and all good.
Afterwards, we delete all the number 1 and number 3 volume, leaving us exclusively with the clear main component, ready to be processed further.
We return the volumes to dem real scale.
About the parameters, based on testing I don't recommend changing the thresholds from dem default values, first of all they make sense statistically and second they work as intended.
Window length can and should be adjusted, find your own way, or leave the default value. ML (moving location) length is up to you as well.
So yeah, you can see now we can smooth the data and make it visually appealing not only by applying a smooth filter over it.
All good TV?
Range Detect SystemTechnical analysis indicator designed to identify potential significant price ranges and the distribution of volume within those ranges. The system helps traders calculate POC and show volume history. Also detecting breakouts or potential reversals. System identifies ranges with a high probability of price consolidation and helps screen out extreme price moves or ranges that do not meet certain volatility thresholds.
βοΈ Key Features
Range Detection β identifies price ranges where consolidation is occurring.
Volume Profile Calculation β indicator calculates the Point of Control (POC) based on volume distribution within the identified range, enhancing the analysis of market structure.
Volume History β shows where the largest volume was traded from the center of the range. If the volume is greater in the upper part of the range, the color will be green. If the volume is greater in the lower part, the color will be red.
Range Filtering β Includes multi-level filtering options to avoid ranges that are too volatile or outside normal ranges.
Visual Customization β Shows graphical indicators for potential bullish or bearish crossovers at the upper and lower range boundaries. Users can choose the style and color of the lines, making it easier to visualize ranges and important levels on the chart.
Alerts β system will notify you when a range has been created and also when the price leaves the range.
βοΈ How it works
Extremes (Pivot Points) are taken as a basis, after confirming the relevance of the extremes we take the upper and lower extremes and form a range. We check if it does not violate a number of rules and filters, perform volume calculations, and only then is the range displayed.
Pivot points is a built-in feature that shows an extremum if it has not been updated N bars to the left and N bars to the right. Therefore, there is a delay depending on the bars specified to check, which allows for a more accurate range. This approach allows not to make unnecessary recalculations, which completely eliminates the possibility of redrawing or range changes.
βοΈ Settings
Left Bars and Right Bars β Allows you to define the point that is the highest among the specified number of bars to the left and right of this point.
Range Logic β Select from which point to draw the range. Maximums only, Minimums only or both.
Use Wick β Option to consider the wick of the candles when identifying Range.
Breakout Confirmation β The number of bars required to confirm a breakout, after which the range will close.
Minimum Range Length β Sets the minimum number of candles needed for a range to be considered valid.
Row Size β Number of levels to calculate POC. *Larger values increase the script load.
% Range Filter β Dont Show Range is than more N% of Average Range.
Multi Filter β Allows use of Bollinger Bands, ATR, SMA, or Highest-Lowest range channels for filtering ranges based on volatility.
Range Hit β Shows graphical labels when price hits the upper or lower boundaries of the range, signaling potential reversal or breakout points.
Range Start β Show points where Range was created.
Linear Regression Channel UltimateKey Features and Benefits
Logarithmic scale option for improved analysis of long-term trends and volatile markets
Activity-based profiling using either touch count or volume data
Customizable channel width and number of profile fills
Adjustable number of most active levels displayed
Highly configurable visual settings for optimal chart readability
Why Logarithmic Scale Matters
The logarithmic scale option is a game-changer for analyzing assets with exponential growth or high volatility. Unlike linear scales, log scales represent percentage changes consistently across the price range. This allows for:
Better visualization of long-term trends
More accurate comparison of price movements across different price levels
Improved analysis of volatile assets or markets experiencing rapid growth
How It Works
The indicator calculates a linear regression line based on the specified period
Upper and lower channel lines are drawn at a customizable distance from the regression line
The space between the channel lines is divided into a user-defined number of levels
For each level, the indicator tracks either:
- The number of times price touches the level (touch count method)
- The total volume traded when price is at the level (volume method)
The most active levels are highlighted based on this activity data
Understanding Touch Count vs Volume
Touch count method: Useful for identifying key support/resistance levels based on price action alone
Volume method: Provides insight into levels where the most trading activity occurs, potentially indicating stronger support/resistance
Practical Applications
Trend identification and strength assessment
Support and resistance level discovery
Entry and exit point optimization
Volume profile analysis for improved market structure understanding
This Linear Regression Channel indicator combines powerful statistical analysis with flexible visualization options, making it an invaluable tool for traders and analysts across various timeframes and markets. Its unique features, especially the logarithmic scale and activity profiling, provide deeper insights into market behavior and potential turning points.
Volume Heatmap 2024 | NXT2017 Christmas EditionHi big players around the world,
I wish you a merry christmas time.
Today I have a nice present for you: a new volume heatmap indicator for free using!
HISTORY
My first volume heatmap project got a lot of feedback and a big demand. You can find it here:
In this time pinescript version 4 was the newest one and I worked the first time with arrays.
Today we have pinescript version 5 and some new features. This is why I tried again with matrix function and the results are better than I expected.
HOW IT WORKS
The indicator calculates similar like the volume profile. It looks back and every volume where the close price is on the same row area, the volume will cumulated. How much rows the new chart view is showing, you can choose manually.
The mind behind this is to find high volume levels, where high volume catch the price in a range or get function as support/resistance line.
PICTURES
I hope it helps for your trading. You are welcome to give some comments.
Merry christmas and best regards
NXT2017